<jhass[m]>
rapha: with -p it reads the file named likewise. -p implies -n which puts a while gets; loop around the expression supplied to -e. Kernel#gets forwards to ARGF#gets. ARGF reads all files in ARGV and then standard input
<rapha>
jhass[m]: i knew about -e and -n and the addition that -p makes to -n, but where does the "bbb" come in?
goepsilongo has joined #ruby
<jhass[m]>
it's just a filename
<rapha>
oooooooooooooooh
<rapha>
i was always using -ep together with a pipe ... the OP there was using with a file
gggpkm has quit [Remote host closed the connection]
gggpkm has joined #ruby
gggpkm has quit [Remote host closed the connection]
gggpkm has joined #ruby
gggpkm has quit [Remote host closed the connection]
gggpkm has joined #ruby
gggpkm has quit [Remote host closed the connection]
gggpkm has joined #ruby
gggpkm has quit [Ping timeout: 252 seconds]
postmodern has joined #ruby
<donofrio>
just starting to learn ruby but why would you have a dictionary with a number like test_grades = {3 => 95.2} puts test_grades [3] juse seems diffrent to use a varable as a number?
sixecho has joined #ruby
<donofrio>
juse = just (typo)
<nakilon>
you can use anything as a key
<nakilon>
and as a value
<donofrio>
yah that just seems diffrent to me, used to alphabet for varable name now a number as a varable
<donofrio>
now = not
<nakilon>
you are free to use any alphabet
<donofrio>
yep I see that and it seems I can use numbers like {77 => 105} puts test_grade [77] and it prints 105
<donofrio>
go easy on me I'm in day one of ruby ;)
<donofrio>
so, puts [1] prints foo?
<nakilon>
yeah
<nakilon>
1 is just a literal that means an instance of a class Integer in Ruby runtime
<donofrio>
so what does last part print puts String [] output?
<nakilon>
"foo" is String, :bar is Symbol, ENV is a default Hash constant containing all the environment variables, String is an instance of a class Class, ->{} is a lambda
<donofrio>
lambda?
<nakilon>
{String => "foo"}[String] #=> "foo"
unmanbearpig has quit [Quit: unmanbearpig]
unmanbearpig has joined #ruby
<nakilon>
lambda is a function that can be assigned to a variable to be called later, like function(){...} in javascript, also they now have the "arrow syntax" too and look like Ruby lambdas
tbaeder has quit [Ping timeout: 245 seconds]
Cameronian has quit [Remote host closed the connection]
Cameronian has joined #ruby
<adam12>
donofrio: As nakilon mentioned, you can basically use any Ruby object as a key in a Hash (or as you said, dictionary). Same obviously applies to the value as well, but that should be obvious.
<adam12>
donofrio: The difference between { 3 => 95.2 } and an Array with 95.2 in position 3 is that a Hash can have missing keys more naturally, where as an Array would have `nil` for the missing keys.
<adam12>
donofrio: ie. [nil, nil, nil, 95.2]
<adam12>
donofrio: They both use `[]` for read and `[]=` for write, so it's transparent to you, and part of a "protocol" that Ruby implements for some things.
Cameronian has quit [Quit: Leaving]
Cameronian has joined #ruby
Cameronian has quit [Client Quit]
Qchmqs has quit [Ping timeout: 252 seconds]
walez has quit [Quit: Leaving]
goepsilongo_ has joined #ruby
goepsilongo has quit [Ping timeout: 245 seconds]
goepsilongo has joined #ruby
goepsilongo_ has quit [Ping timeout: 245 seconds]
roadie has quit [Remote host closed the connection]
darkxploit has quit [Read error: No route to host]
reset has joined #ruby
stevea has quit [Quit: Either I or my computer has gone to sleep. ZZZzzz…]
hexology has joined #ruby
<hexology>
hi ruby users! the extent of my ruby experience is writing Homebrew formulas, so i apologize if the answer is obvious. i am getting the error "TypeError: no implicit conversion of Hash into String" when i try to pass some env vars to kernel#system(). my code is here: https://bpa.st/VEQA, the error is reported on line 15, where "system(" starts
<hexology>
i don't see what's different about my code versus what's in the various examples, as well as the ruby docs
<hexology>
i guess i will have to take this up with the homebrew people
<hexology>
but to close the loop on this: it means that somewhere inside a library, a string was required, and it refused to convert the hash {} into said string?
<weaksauce>
hexology the { starts a hash
<weaksauce>
and system is expecting strings
crankharder has joined #ruby
georgemp has quit [Remote host closed the connection]