apeiros changed the topic of #ruby-lang to: Nick registration required to talk || Ruby 2.0.0-p247: http://ruby-lang.org (Ruby 1.9.3-p448) || Paste >3 lines of text on http://gist.github.com
benanne has quit [Quit: kbai]
nathanstitt has joined #ruby-lang
alexju has joined #ruby-lang
kgrz has joined #ruby-lang
kgrz has quit [Read error: Connection reset by peer]
kgrz has joined #ruby-lang
benwoody has joined #ruby-lang
benwoody has quit [Client Quit]
esad has joined #ruby-lang
majjoha has joined #ruby-lang
diegoviola has joined #ruby-lang
kgrz has quit [Ping timeout: 272 seconds]
martndemus has joined #ruby-lang
majjoha has quit [Ping timeout: 248 seconds]
alexju has quit [Ping timeout: 240 seconds]
alexju has joined #ruby-lang
martndemus has quit [Ping timeout: 272 seconds]
hahuang65 has quit [Read error: Connection reset by peer]
saarinen has joined #ruby-lang
hahuang65 has joined #ruby-lang
alexju_ has joined #ruby-lang
alexju has quit [Ping timeout: 248 seconds]
havenwood has quit [Remote host closed the connection]
kireevco_ has joined #ruby-lang
Elico has quit [Quit: Elico]
saarinen has quit [Ping timeout: 265 seconds]
stamina has quit [Read error: Operation timed out]
bzalasky has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
charliesome has joined #ruby-lang
tshine has joined #ruby-lang
jeff_r has joined #ruby-lang
jeff_r has quit [Remote host closed the connection]
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
ssb123 has quit [Remote host closed the connection]
ssb123 has joined #ruby-lang
bzalasky has quit [Ping timeout: 240 seconds]
majjoha has joined #ruby-lang
SteveBenner09 has joined #ruby-lang
ssb123 has quit [Ping timeout: 245 seconds]
SteveBenner09 has quit [Remote host closed the connection]
SteveBenner09 has joined #ruby-lang
vlad_starkov has joined #ruby-lang
bzalasky has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 248 seconds]
diegoviola has quit [Ping timeout: 272 seconds]
majjoha has quit [Ping timeout: 245 seconds]
esad has quit [Quit: Computer has gone to sleep.]
havenwood has joined #ruby-lang
Rarrikins has quit [Ping timeout: 265 seconds]
diegoviola has joined #ruby-lang
bf4 has joined #ruby-lang
majjoha has joined #ruby-lang
nisstyre has joined #ruby-lang
martndemus has joined #ruby-lang
fuhgeddaboudit has quit [Remote host closed the connection]
majjoha has quit [Ping timeout: 248 seconds]
ssb123 has joined #ruby-lang
dhruvasagar has joined #ruby-lang
SteveBenner09 has quit [Remote host closed the connection]
SteveBenner09 has joined #ruby-lang
martndemus has quit [Ping timeout: 272 seconds]
SteveBen_ has joined #ruby-lang
SteveBenner09 has quit [Ping timeout: 245 seconds]
Johz has quit [Quit: Leaving]
bf4 has quit [Ping timeout: 265 seconds]
jiuweigui has quit [Quit: iQuit!]
havenwood has quit [Remote host closed the connection]
havenwood has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
SteveBen_ has quit [Ping timeout: 248 seconds]
ikrima has quit [Ping timeout: 240 seconds]
ikrima has joined #ruby-lang
SteveBenner09 has joined #ruby-lang
havenwood has joined #ruby-lang
SteveBenner09 has quit [Remote host closed the connection]
majjoha has joined #ruby-lang
majjoha has quit [Ping timeout: 272 seconds]
bzalasky has quit [Remote host closed the connection]
n8nl has quit [Ping timeout: 248 seconds]
bzalasky has joined #ruby-lang
n8nl has joined #ruby-lang
Rarrikins has joined #ruby-lang
alexju_ has quit [Remote host closed the connection]
<hfp>
A new question for you tonight: Could someone explain why in this pastebin http://pastebin.com/2e6quMbB the assignation to the hash I am doing in the loop is valid but the one below isn't? I understand I should add quotes to the 'test' iteration but I don't understand why it's not needed with the each method. Thanks!
<hfp>
'test' assignation* not iteration
alexju has quit [Remote host closed the connection]
alexju has joined #ruby-lang
shinnya has quit [Ping timeout: 248 seconds]
hogeo has joined #ruby-lang
alexju has quit [Ping timeout: 245 seconds]
alexju has joined #ruby-lang
<havenwood>
hfp: `test` isn't defined but a key is expected
<havenwood>
hfp: `:test` the symbol or `'test'` the string would work, or if you assigned the bareword `test` to something
<havenwood>
hfp: a local variable or method could set test, for example
shinnya has joined #ruby-lang
majjoha has joined #ruby-lang
<hfp>
havenwood: what I don't get is why it shouldn't be freq[`w`] += 1 rather than freq[w] += 1 for this to work
<hfp>
I have to say I'm new to Ruby and come from PHP
<hfp>
in PHP freq[$w] would not be the same as freq"$w"]
<havenwood>
hfp: inside the block the value of the current iteration is set to `w`
<hfp>
Yes I meant single quotes but they don't show well on IRC so I put `
alexju_ has joined #ruby-lang
<havenwood>
hfp: ah, inside a quote is a string
<hfp>
Sorry I'm not being very clear... Do you understand what I mean or should I be clearer?
<havenwood>
hfp: Clearer, i'm afraid. The local variable inside the block `w` is set to the string value of each iteration as it happens.
alexju has quit [Read error: Connection reset by peer]
<havenwood>
hfp: like on the first iteration, `w == 'Some'`
majjoha has quit [Ping timeout: 248 seconds]
symm- has joined #ruby-lang
enmand has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hfp>
Ok. In PHP, consider this: freq = array(); w = "string"; print $freq[$w]; it would fail because it should be $freq["$w"] otherwise it messes up when the parser substitutes the variables.
<hfp>
What I don't understand in that Ruby snippet is why it works with freq[w] and doesn't need to be freq["w"] since freq[key] doesn't work but freq["key"] does.
alexju has joined #ruby-lang
alexju_ has quit [Read error: Connection reset by peer]
<hfp>
I guess not having a sigil in front of variables is also confusing fo rme in Ruby...
<havenwood>
hfp: w is being set in the block, it is in fact on each iteration a different String
<havenwood>
hfp: you'll get used to barewords in Ruby, it isn't hard once you get accustomed to it
<havenwood>
hfp: they are local variables or methods
<hfp>
I think I'm starting to get it. It works because w = "string" from the iteration, right?
<hfp>
And as such, Ruby recognizes the w object is a string so it doesn't need the quotes because it isn't substitution as it can be in PHP, correct?
kek has quit [Remote host closed the connection]
priodev has quit [Ping timeout: 240 seconds]
<jrobeson>
how would that break in php?
<jrobeson>
as long as such a key existed that is
<jrobeson>
i've never done $freq["$w"] in all my years of php coding
<jrobeson>
ever
mistym has quit [Remote host closed the connection]
<jrobeson>
it's always freq[$w]
<hfp>
Ok then, I confused myself... I know where the door is...
<jrobeson>
do you mean because of that unicode character?
Grimscribe has quit [Quit: Grimscribe]
<havenwood>
hfp: i don't know php well enough to weigh in, but seems you're on the right track!
<jrobeson>
hfp, for the most part (except for regex) you can pretend that $foo in php is the same as foo in ruby
<hfp>
No, I was thinking that w = string; freq[$w] would give freq[string] when it should have been freq["string"] to be correct.
<jrobeson>
in php and ruby you'd need to quote the string if it isn't a variable.. that's what i'm not sure
<hfp>
I think I got it, I just am very bad at phrasing my ideas tonight...
<jrobeson>
hfp, it'd be better if you put this in a gist or pastie or something .. give yourself a chance to write it out correctly
<hfp>
jrobeson: Ok
hogeo has quit [Remote host closed the connection]
alexju has quit [Read error: Connection reset by peer]
priodev has joined #ruby-lang
<hfp>
jrobeson: Nevermind, my question didn't make sense I answered it with a bit of experimenting.
<imperator>
did ruby 2.0 end up adding any DBC stuff? i don't remember
* hfp
goes to hide.
toretore has joined #ruby-lang
<jrobeson>
hfp, i'm sure you'll be be back again
<havenwood>
hfp: Nothing wrong with learning! :)
<jrobeson>
just play around some more, it'll all become clear
<jrobeson>
if it doesn't havenwood will be here for you :)
<hfp>
:) Thanks
rickhull has quit [Quit: Leaving.]
alexju has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
* imperator
confused hfp with hfb for a second there ;)
<hfp>
My confusion is spreading
majjoha has joined #ruby-lang
martndemus has joined #ruby-lang
majjoha has quit [Ping timeout: 265 seconds]
kek has joined #ruby-lang
hashkey has quit [Remote host closed the connection]
julweber has joined #ruby-lang
martndemus has quit [Ping timeout: 240 seconds]
nisstyre has quit [Quit: Leaving]
ssb123 has quit [Remote host closed the connection]
ssb123 has joined #ruby-lang
symm- has quit [Ping timeout: 248 seconds]
ssb123 has quit [Read error: No route to host]
ssb123 has joined #ruby-lang
hogeo has joined #ruby-lang
kurko_ has joined #ruby-lang
RominNoodleS has joined #ruby-lang
dhruvasagar has joined #ruby-lang
jithu has joined #ruby-lang
majjoha has joined #ruby-lang
RominNoodleS has left #ruby-lang [#ruby-lang]
mdedetrich has quit [Quit: Computer has gone to sleep.]
majjoha has quit [Ping timeout: 240 seconds]
saarinen has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 248 seconds]
csffsc_ has joined #ruby-lang
csffsc has quit [Ping timeout: 245 seconds]
saarinen has quit [Ping timeout: 272 seconds]
kurko_ has quit [Ping timeout: 240 seconds]
kek has quit [Remote host closed the connection]
kek has joined #ruby-lang
kurko_ has joined #ruby-lang
kek has quit [Ping timeout: 248 seconds]
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
dhruvasagar has joined #ruby-lang
bzalasky has quit [Ping timeout: 240 seconds]
mdedetrich has joined #ruby-lang
charliesome has quit [Ping timeout: 248 seconds]
bzalasky has joined #ruby-lang
ssb123 has quit [Remote host closed the connection]
Coincidental has joined #ruby-lang
ssb123 has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 240 seconds]
kurko_ has quit [Quit: Computer has gone to sleep.]
martndemus has joined #ruby-lang
ssb123 has quit [Ping timeout: 245 seconds]
alexju has quit [Read error: Connection reset by peer]
alexju has joined #ruby-lang
natevick has joined #ruby-lang
martndemus has quit [Ping timeout: 256 seconds]
natevick has quit [Client Quit]
Rarrikins has quit [Read error: Connection reset by peer]
ckim has quit [Remote host closed the connection]
ckim has joined #ruby-lang
ckim has quit [Ping timeout: 272 seconds]
charliesome has joined #ruby-lang
imperator has quit [Quit: Valete!]
mistym has joined #ruby-lang
jsullivandigs has joined #ruby-lang
dhruvasagar has joined #ruby-lang
jsullivandigs has quit [Read error: Connection reset by peer]
digs has joined #ruby-lang
digs is now known as Guest56338
majjoha has joined #ruby-lang
cads has joined #ruby-lang
majjoha has quit [Ping timeout: 272 seconds]
diegoviola has quit [Quit: WeeChat 0.4.2]
jithu has quit [Quit: Mother, did it need to be so high?]
tdy has quit [Read error: Connection reset by peer]
tdy has joined #ruby-lang
jithu has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
ckim has joined #ruby-lang
majjoha has joined #ruby-lang
martndemus has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
csffsc_ has quit [Read error: Connection reset by peer]
csffsc has joined #ruby-lang
majjoha has quit [Ping timeout: 265 seconds]
banisterfiend has quit [Quit: Computer has gone to sleep.]
martndemus has quit [Ping timeout: 248 seconds]
richardburton has quit [Ping timeout: 248 seconds]
csffsc has quit [Ping timeout: 256 seconds]
ssb123 has joined #ruby-lang
csffsc has joined #ruby-lang
lsegal has quit [Read error: Connection reset by peer]
lsegal has joined #ruby-lang
charliesome has quit [Ping timeout: 240 seconds]
mdedetrich has quit [Quit: Computer has gone to sleep.]
dhruvasagar has quit [Read error: Operation timed out]
havenwood has joined #ruby-lang
ssb123 has quit [Ping timeout: 245 seconds]
richardburton has joined #ruby-lang
kireevco_ has quit [Ping timeout: 248 seconds]
kireevco_ has joined #ruby-lang
majjoha has joined #ruby-lang
sdpy has joined #ruby-lang
kireevco_ has quit [Ping timeout: 248 seconds]
majjoha has quit [Ping timeout: 245 seconds]
kek has joined #ruby-lang
simoz has joined #ruby-lang
Coincidental has quit [Remote host closed the connection]
Coincidental has joined #ruby-lang
richardburton1 has joined #ruby-lang
richardburton has quit [Ping timeout: 265 seconds]
kgrz has joined #ruby-lang
Coincidental has quit [Ping timeout: 240 seconds]
dhruvasagar has joined #ruby-lang
kek has quit [Remote host closed the connection]
postmodern has quit [Quit: Leaving]
wallerdev has quit [Quit: wallerdev]
postmodern has joined #ruby-lang
Guest56338 has quit [Remote host closed the connection]
majjoha has joined #ruby-lang
martndemus has joined #ruby-lang
majjoha has quit [Ping timeout: 240 seconds]
tomzx_mac has quit [Ping timeout: 240 seconds]
martndemus has quit [Ping timeout: 240 seconds]
Coincide_ has joined #ruby-lang
simoz has quit [Ping timeout: 240 seconds]
skade has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
Elico has joined #ruby-lang
guest132435 has joined #ruby-lang
michael_mbp is now known as zz_michael_mbp
julweber has quit [Remote host closed the connection]
julweber has joined #ruby-lang
toretore has quit [Read error: Connection reset by peer]
toretore has joined #ruby-lang
julweber has quit [Ping timeout: 272 seconds]
tbuehlmann has joined #ruby-lang
majjoha has joined #ruby-lang
martndemus has joined #ruby-lang
majjoha has quit [Ping timeout: 240 seconds]
stardiviner has joined #ruby-lang
stardiviner has quit [Client Quit]
martndemus has quit [Ping timeout: 272 seconds]
skade has quit [Quit: Computer has gone to sleep.]
postmodern has quit [Quit: Leaving]
julweber has joined #ruby-lang
arBmind has joined #ruby-lang
julweber has quit [Ping timeout: 272 seconds]
Boohbah has quit [Ping timeout: 240 seconds]
rippa has joined #ruby-lang
Boohbah has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
heftig has quit [Read error: Connection reset by peer]
heftig has joined #ruby-lang
skade has joined #ruby-lang
richardburton has joined #ruby-lang
kgrz has quit [Ping timeout: 256 seconds]
majjoha has joined #ruby-lang
arBmind has quit [Quit: Leaving.]
guest132435 has quit [Quit: guest132435]
richardburton1 has quit [Ping timeout: 272 seconds]
martndemus has joined #ruby-lang
MaddinXx has joined #ruby-lang
majjoha has quit [Ping timeout: 248 seconds]
metus_violarium has joined #ruby-lang
martndemus has quit [Ping timeout: 240 seconds]
adambeynon has joined #ruby-lang
vlad_starkov has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
Ropz has joined #ruby-lang
csffsc has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
csffsc has joined #ruby-lang
jxie has quit [Read error: Connection reset by peer]
jxie_ has joined #ruby-lang
Rarrikins has joined #ruby-lang
csffsc has quit [Ping timeout: 248 seconds]
greenrecyclebin has joined #ruby-lang
relix has joined #ruby-lang
majjoha has joined #ruby-lang
workmad3 has joined #ruby-lang
alexju has quit [Remote host closed the connection]
alexju has joined #ruby-lang
majjoha has quit [Ping timeout: 272 seconds]
alexju has quit [Ping timeout: 248 seconds]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nofxx has quit [Ping timeout: 272 seconds]
io_syl has quit []
Elico has quit [Quit: Elico]
richardburton has quit [Quit: Leaving.]
Ropz has quit [Ping timeout: 272 seconds]
vlad_starkov has joined #ruby-lang
majjoha has joined #ruby-lang
martndemus has joined #ruby-lang
majjoha has quit [Ping timeout: 240 seconds]
kgrz has quit [Ping timeout: 272 seconds]
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
vlad_starkov has quit [Remote host closed the connection]
jstemmer has quit [Quit: leaving]
MaddinXx has quit [Remote host closed the connection]
jiuweigui has joined #ruby-lang
Ropz has joined #ruby-lang
vlad_starkov has joined #ruby-lang
ikrima has quit [Quit: Computer has gone to sleep.]
bastilian has joined #ruby-lang
csffsc has joined #ruby-lang
majjoha has joined #ruby-lang
richardburton has joined #ruby-lang
csffsc has quit [Ping timeout: 248 seconds]
mlangenberg has joined #ruby-lang
relix has joined #ruby-lang
greenrecyclebin has quit [Quit: leaving]
majjoha has quit [Ping timeout: 245 seconds]
banisterfiend has joined #ruby-lang
rickhull has joined #ruby-lang
stamina has joined #ruby-lang
dkam has joined #ruby-lang
<dkam>
Hi everyone. Just installed Xcode 5 and found that gcc-4.2 points to the no-longer-distributed-with-xcode llvm-gcc-4.2. Installing gems now failed with "make: gcc-4.2: No such file or directory". Any ideas on how to fix this?
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Coincide_ has quit [Remote host closed the connection]
Coincidental has joined #ruby-lang
mlangenberg has quit [Quit: mlangenberg]
julweber has joined #ruby-lang
Coincidental has quit [Ping timeout: 248 seconds]
majjoha has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 272 seconds]
mlangenberg has joined #ruby-lang
Oloryn_lt2 has quit [Ping timeout: 240 seconds]
majjoha has quit [Ping timeout: 265 seconds]
zz_michael_mbp is now known as michael_mbp
Mon_Ouie has joined #ruby-lang
Ropz has quit [Ping timeout: 272 seconds]
julweber has quit [Remote host closed the connection]
hahuang65 has quit [Ping timeout: 272 seconds]
julweber has joined #ruby-lang
MrZYX|off is now known as MrZYX
julweber has quit [Ping timeout: 256 seconds]
io_syl has joined #ruby-lang
vlad_sta_ has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 240 seconds]
mlangenberg has quit [Quit: mlangenberg]
Johz has joined #ruby-lang
imperator has joined #ruby-lang
majjoha has joined #ruby-lang
vlad_sta_ has quit [Remote host closed the connection]
majjoha has quit [Ping timeout: 272 seconds]
mnngfltg has joined #ruby-lang
jiuweigui has quit [Quit: iQuit!]
jithu has quit [Quit: Mother, did it need to be so high?]
io_syl has quit []
jithu has joined #ruby-lang
sepp2k has joined #ruby-lang
vlad_starkov has joined #ruby-lang
Ropz has joined #ruby-lang
VTLob has joined #ruby-lang
mnngfltg has quit [Quit: Ex-Chat]
mnngfltg has joined #ruby-lang
majjoha has joined #ruby-lang
mnngfltg has quit [Client Quit]
mnngfltg has joined #ruby-lang
rickhull has quit [Quit: Leaving.]
vlad_starkov has quit [Remote host closed the connection]
mdedetrich has joined #ruby-lang
apeiros has quit [Remote host closed the connection]
majjoha has quit [Ping timeout: 265 seconds]
symm- has joined #ruby-lang
jxie_ has quit [Quit: leaving]
kgrz has joined #ruby-lang
mistym has quit [Remote host closed the connection]
mnngfltg has quit [Ping timeout: 248 seconds]
mbj has quit [Read error: Connection reset by peer]
bastilian has quit [Ping timeout: 272 seconds]
MrZYX is now known as MrZYX|off
r0bgleeson has quit [Ping timeout: 240 seconds]
Ropz has quit [Ping timeout: 272 seconds]
majjoha has joined #ruby-lang
symm- has quit [Ping timeout: 272 seconds]
majjoha has quit [Ping timeout: 240 seconds]
jithu has quit [Quit: Mother, did it need to be so high?]
bastilian has joined #ruby-lang
enmand has joined #ruby-lang
ledestin has quit [Quit: ledestin]
MrZYX|off is now known as MrZYX
jithu has joined #ruby-lang
enmand has quit [Ping timeout: 272 seconds]
kgrz has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
alexju has joined #ruby-lang
postmodern has joined #ruby-lang
kgrz has quit [Ping timeout: 272 seconds]
rippa has quit [Ping timeout: 248 seconds]
majjoha has joined #ruby-lang
majjoha has quit [Ping timeout: 265 seconds]
mdedetrich has quit [Quit: Computer has gone to sleep.]
jithu has quit [Quit: Mother, did it need to be so high?]
kgrz has joined #ruby-lang
mdedetrich has joined #ruby-lang
kgrz has quit [Read error: Connection reset by peer]
kgrz has joined #ruby-lang
jithu has joined #ruby-lang
jithu has quit [Client Quit]
mlangenberg has joined #ruby-lang
qinix has joined #ruby-lang
r0bgleeson has joined #ruby-lang
v9r has quit [Quit: leaving]
csffsc has joined #ruby-lang
chobbit has joined #ruby-lang
<chobbit>
I need some help with regex. I want to .gsub %arg-[any number]%. I have the [any number] part, but I don't know how to add the strings to the sides
<chobbit>
nvm, got it in #ruby
wallerdev has joined #ruby-lang
csffsc has quit [Ping timeout: 248 seconds]
majjoha has joined #ruby-lang
mdedetrich has quit [Quit: Computer has gone to sleep.]
majjoha has quit [Ping timeout: 248 seconds]
r0bgleeson has quit [Quit: WeeChat 0.4.1]
wallerdev has quit [Quit: wallerdev]
wallerdev has joined #ruby-lang
Oloryn_lt2 has joined #ruby-lang
mdedetrich has joined #ruby-lang
rue has quit [Remote host closed the connection]
rue has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
sdpy has quit [Quit: Leaving]
rue has quit [Remote host closed the connection]
rue_XIV has joined #ruby-lang
majjoha has joined #ruby-lang
mlangenberg_ has joined #ruby-lang
mlangenberg has quit [Ping timeout: 256 seconds]
mlangenberg_ is now known as mlangenberg
mdedetrich has quit [Quit: Computer has gone to sleep.]
julweber has joined #ruby-lang
julweber has quit [Remote host closed the connection]
julweber has joined #ruby-lang
majjoha has quit [Ping timeout: 272 seconds]
julweber has quit [Ping timeout: 245 seconds]
vlad_starkov has joined #ruby-lang
ckim has quit [Remote host closed the connection]
ckim has joined #ruby-lang
ckim has quit [Ping timeout: 265 seconds]
alexju_ has joined #ruby-lang
alexju has quit [Ping timeout: 272 seconds]
tdy has quit [Ping timeout: 265 seconds]
relix has joined #ruby-lang
alexju_ has quit [Remote host closed the connection]
alexju has joined #ruby-lang
ckim has joined #ruby-lang
alexju has quit [Ping timeout: 272 seconds]
cnivolle has joined #ruby-lang
majjoha has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
majjoha has quit [Ping timeout: 272 seconds]
vlad_starkov has joined #ruby-lang
cnivolle has quit [Remote host closed the connection]
cnivolle has joined #ruby-lang
qinix has left #ruby-lang [#ruby-lang]
majjoha has joined #ruby-lang
tkuchiki_ has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
stef_204 has joined #ruby-lang
majjoha has quit [Ping timeout: 248 seconds]
tkuchiki has quit [Ping timeout: 240 seconds]
rdg has joined #ruby-lang
mlangenberg has quit [Quit: mlangenberg]
sdpy has joined #ruby-lang
cnivolle has quit [Ping timeout: 240 seconds]
charliesome has joined #ruby-lang
michael_mbp has left #ruby-lang ["19"]
csffsc has joined #ruby-lang
michael_mbp has joined #ruby-lang
mlangenberg has joined #ruby-lang
charliesome has quit [Ping timeout: 245 seconds]
tomzx_mac has joined #ruby-lang
rdg has quit [Quit: ttfn]
csffsc has quit [Remote host closed the connection]
csffsc has joined #ruby-lang
davispuh has joined #ruby-lang
csffsc has quit [Ping timeout: 240 seconds]
csffsc has joined #ruby-lang
postmodern has quit [Quit: Leaving]
benanne has joined #ruby-lang
mucker has joined #ruby-lang
wallerdev has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
majjoha has joined #ruby-lang
vlad_starkov has joined #ruby-lang
elia has joined #ruby-lang
Johz has quit [Ping timeout: 265 seconds]
majjoha has quit [Ping timeout: 256 seconds]
elia has quit [Client Quit]
mnngfltg has joined #ruby-lang
ruurd has joined #ruby-lang
tdy has joined #ruby-lang
mlangenberg has quit [Quit: mlangenberg]
ruurd_ has joined #ruby-lang
ruurd_ is now known as Guest67413
ruurd has quit [Ping timeout: 264 seconds]
wallerdev has quit [Quit: wallerdev]
mbj has joined #ruby-lang
jxie has joined #ruby-lang
nisstyre has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
metus has joined #ruby-lang
mlangenberg has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
richardburton has joined #ruby-lang
metus_violarium has quit [Ping timeout: 240 seconds]
Ropz has joined #ruby-lang
richardburton1 has joined #ruby-lang
richardburton has quit [Read error: Connection reset by peer]
Mon_Ouie has quit [Ping timeout: 272 seconds]
majjoha has joined #ruby-lang
richardburton has joined #ruby-lang
richardburton1 has quit [Read error: Connection reset by peer]
richardburton has quit [Read error: Connection reset by peer]
io_syl has joined #ruby-lang
io_syl has quit [Client Quit]
kith has quit [Read error: Connection reset by peer]
kith has joined #ruby-lang
bzb has joined #ruby-lang
kek has joined #ruby-lang
majjoha has quit [Ping timeout: 272 seconds]
julian___ has joined #ruby-lang
<julian___>
So what's so bad about using the eval method?
<julian___>
I mean, security risk, inefficent, what is it?
<MrZYX>
not sure about the performance on ruby, but definitely slower. The main concern is indeed security. And in ruby I'd call it a code smell, there's almost always an alternative way
symm- has joined #ruby-lang
wallerdev has joined #ruby-lang
<julian___>
MrZYX: okay...how would you suggest creating a varible programatically without using the eval method?
<MrZYX>
a local or an instance variable? In most cases you want to use a hash instead
<Kero>
eval makes code harder to understand: refactoring and navigation (where is that method defined?) tend to fail.
<julian___>
That code won't run, but it shows you where I'm using it
<julian___>
Still don't really understand how a hash would work here :)
<MrZYX>
well, you already use instance_variable_set. There's instance_variable_get
<julian___>
ahh
<julian___>
awesome
havenwood has joined #ruby-lang
<davispuh>
I've never had need to use eval in Ruby
<Kero>
window = Window.new(...); window.attron(etc), etc, and only once instance_variable_set
saarinen has quit [Ping timeout: 272 seconds]
julian___ has quit [Remote host closed the connection]
kireevco_ has joined #ruby-lang
kek has quit [Remote host closed the connection]
julian__2 has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
nathanstitt has joined #ruby-lang
retro|cz has joined #ruby-lang
kek has joined #ruby-lang
r0bgleeson has joined #ruby-lang
majjoha has joined #ruby-lang
majjoha has quit [Ping timeout: 248 seconds]
wallerdev has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 245 seconds]
vlad_starkov has joined #ruby-lang
Rarrikins has quit [Ping timeout: 272 seconds]
Rarrikins has joined #ruby-lang
<julian__2>
Is using too many instance variables bad?
<julian__2>
should I use variables where possible?
<julian__2>
Is this better for memory?
<julian__2>
finally, then is there a 'variable_set' method as opposed to 'instance_variable_set'? I can't seem to find one..
havenwood has quit [Remote host closed the connection]
mbj_ has joined #ruby-lang
kireevco_ has quit [Ping timeout: 248 seconds]
Guu has quit [Ping timeout: 248 seconds]
Kabaka has quit [Remote host closed the connection]
Guu has joined #ruby-lang
jithu has joined #ruby-lang
mbj has quit [Ping timeout: 248 seconds]
jithu has quit [Client Quit]
Johz has joined #ruby-lang
<r0bgleeson>
julian__2: yeah, too many instance variables is usually bad, it has nothing to do with memory though. whether or not an instance variable stays in scope depends on the thing that references the object. local variables go out of scope when the method does, but instance/local variable is usually a choice on how persistent you want the variable to be
<r0bgleeson>
there is no variable_set.
<r0bgleeson>
and "out of scope local variables" is kind of different with if a proc is around.
<r0bgleeson>
-with
majjoha has joined #ruby-lang
<MrZYX>
julian__2: if you feel the need to do something like variable_set "foo#{bar}", x / variable_get "foo#{bar}" do foo = {}; foo[bar] = x; / foo[bar] instead
kireevco_ has joined #ruby-lang
workmad3 has quit [Ping timeout: 248 seconds]
majjoha has quit [Ping timeout: 240 seconds]
saarinen has joined #ruby-lang
Kabaka has joined #ruby-lang
saarinen has quit [Ping timeout: 245 seconds]
mbj_ is now known as mbj
Grimscribe has joined #ruby-lang
kurko_ has joined #ruby-lang
mlangenberg has quit [Quit: mlangenberg]
shinnya has quit [Ping timeout: 248 seconds]
micalexa_ has quit [Remote host closed the connection]
workmad3 has joined #ruby-lang
micalexander has joined #ruby-lang
bzb has quit [Remote host closed the connection]
enmand has joined #ruby-lang
micalexander has quit [Ping timeout: 272 seconds]
workmad3 has quit [Ping timeout: 245 seconds]
sindork has quit [Remote host closed the connection]
sindork has joined #ruby-lang
mlangenberg has joined #ruby-lang
<julian__2>
r0bgleeson: Oh I see. Variable are just easier to manage. Instance variables could create some weird bugs maybe :) Can I set variables programatically, then?
<workmad3>
although, as the first result showed, it starts with an enumerator that does lazy evaluation :)
richardburton has joined #ruby-lang
<ichilton>
If it've got an array of hashes - each hash contains an array of hashes - what's the neatest way of getting an array of all of those sub-hashes?
enmand has joined #ruby-lang
<ichilton>
that's a bit vague - here's an example:
<ichilton>
MrZYX: it was the flatten bit I couldn't quite get!
<MrZYX>
depending on what you do with them, there's also stuff like .flat_map
richardburton has quit [Ping timeout: 240 seconds]
<dorei>
flat_map ?
<ichilton>
how would you do it with that?
<dorei>
oh, flat_map is flatten and map combined in one method :)
<MrZYX>
I mean what you plan to do with the result, for example to get all record ids: .map {|hsh| hsh[:records] }.flat_map {|record| record[:rec_id] }
ruskie has quit [Ping timeout: 245 seconds]
barttenbrinke has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
<ErwinNH>
Newbie question: Why do I have to call a class with a .new operator? I don't understand what the .new does.
mdedetrich has quit [Quit: Computer has gone to sleep.]
ruurd has quit [Quit: Leaving...]
wallerdev has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
sepp2k has quit [Ping timeout: 272 seconds]
elia has quit [Quit: Computer has gone to sleep.]
Johz has quit [Ping timeout: 256 seconds]
bzalasky has quit [Ping timeout: 272 seconds]
elia has joined #ruby-lang
ssb123 has quit [Remote host closed the connection]
Ahti333_ has joined #ruby-lang
sepp2k has joined #ruby-lang
ikrima has quit [Quit: Computer has gone to sleep.]
freedrull has joined #ruby-lang
Ahti333 has quit [Ping timeout: 248 seconds]
Ahti333_ is now known as Ahti333
Grimscribe has quit [Quit: Grimscribe]
skade has joined #ruby-lang
ingof has joined #ruby-lang
martndemus has joined #ruby-lang
CoreData has quit [Read error: Connection reset by peer]
CoreData1 has joined #ruby-lang
Johz has joined #ruby-lang
bzalasky has joined #ruby-lang
martndemus has quit [Ping timeout: 240 seconds]
kitak has joined #ruby-lang
CoreData1 has quit [Client Quit]
<Barrin6>
ErwinNH,
<Barrin6>
that's how classes work
CoreData has joined #ruby-lang
<Barrin6>
hard to explain
<Barrin6>
since I"m a noobie too
<ErwinNH>
So just remember that when you want to reference a class, add .new to the end of your call?
<toretore>
new creates an instance of the class
CoreData has quit [Read error: Connection reset by peer]
<Barrin6>
i thoughtyou only use .new to create a new class
CoreData has joined #ruby-lang
<toretore>
User.new #=> aUser
ingof has quit [Ping timeout: 272 seconds]
CoreData has quit [Read error: Connection reset by peer]
CoreData has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<ErwinNH>
Hmm, ok. Thanks. I'm still a little fuzzy on why that's important but I suspect its because I don't fully understand the distinctions of scope.
dingus_khan has joined #ruby-lang
<jrobeson>
ErwinNH, coded in any other language before?
<ErwinNH>
Nope
<ErwinNH>
HTML and CSS plus cut and paste javascript ;)
<jrobeson>
aha
<jrobeson>
generically speaking.. new means.. give me a new instance of this object
<toretore>
ErwinNH: a class is a template for creating objects. when you say `User.new` you create a new user object from the template `User`
<jrobeson>
template is a good way to put it
<ErwinNH>
Ok, so in this example I have a database class that checks the file, makes sure it exists, makes sure its writable, and then writes to it. My interface file needs to create a new instance of this database class in order to perform those functions again?
<jrobeson>
database classes aren't really the best places to start
<jrobeson>
a bit beyond your paygrade atm if you don't know new
<jrobeson>
ErwinNH, you should consider tryruby.org and then the ruby koans
<Barrin6>
nice explanation there
<ErwinNH>
lol i'm sure you're right
<Barrin6>
or play on codeacademy
<jrobeson>
come back to actually writing your own code after that
<ErwinNH>
but I have it working so far
<ErwinNH>
I have a Lynda.com subscrip
<jrobeson>
but then you'll be asking questions every minute
<jrobeson>
better to get some of the basics handled first
<Barrin6>
code academy for basics, then try "learning ruby the hard way"
<jrobeson>
the ruby koans are nice in that you can play as much as you want.. but in your own editor
<Barrin6>
then project euler
<jrobeson>
Barrin6, the ruby koans are good enough.. since you don't have to deal with the browser all the time
<jrobeson>
just download and run it. break it.. see what a real ruby does when you break it
enmand has joined #ruby-lang
<Barrin6>
I never tried ruby koans
<ErwinNH>
Hmm ok, i'll check that out
<Barrin6>
it's that good?
<jrobeson>
well it might be below your skill level now perhaps Barrin6 .. not sure
<Barrin6>
well I'm not that smart at ruby yet, I just pretend
<jrobeson>
it's just a really nice setup to play with.. a directory with all the exampel ruby files.. and it acts like a test
<Barrin6>
ruby is my first language
<jrobeson>
so.. it tells you what you made work since the last time
<Barrin6>
and I only been studying for a month?
Coincidental has quit [Remote host closed the connection]
Coincidental has joined #ruby-lang
csffsc_ has joined #ruby-lang
<julian__2>
is a class method a method that's inside a class?
<julian__2>
class Object def my_method puts "aright" end end
Ahti333 has quit [Quit: Computer has gone to sleep.]
<julian__2>
would 'my_method' be a class method?
<toretore>
no
<toretore>
def self.my_method would
<julian__2>
okay
<julian__2>
that makes sense
ckim has quit [Remote host closed the connection]
ckim has joined #ruby-lang
<julian__2>
the only way I can get variables into thses methods is by making them instance instance methods
<julian__2>
@@var = "foo"
<toretore>
depends
<julian__2>
what's the best way to get variables into these class methods?
<toretore>
depends on what you mean by that
<toretore>
it's not usually something you should be doing
Coincidental has quit [Ping timeout: 248 seconds]
csffsc has quit [Ping timeout: 265 seconds]
<julian__2>
fair point.
<julian__2>
what's wrong with using @@ variables, then?
<Barrin6>
man ruby koans is confusing
<Barrin6>
okay so I downloaded this bad boy
<Barrin6>
edited the first file
<toretore>
julian__2: it would help if you provided the code to see what you're trying to achieve
<toretore>
@@vars are not used much
<toretore>
there's just not much need for them
<julian__2>
no, that's why I'm worried..i'll make an example
dingus_khan has quit [Remote host closed the connection]
<julian__2>
It won't run, but it illustrates what I'm trying to do
<julian__2>
literally get one variable inside blank_window
<julian__2>
I don't want to pass it in as a parameter, because it's a variable that never changes during the operation of the program
Coincidental has joined #ruby-lang
<toretore>
what's the purpose of this code?
skade has quit [Quit: Computer has gone to sleep.]
<Barrin6>
lianj, i added the to_a
<Barrin6>
hmm
nathanstitt has quit [Quit: I growing sleepy]
<julian__2>
Basically, I'm using Curses to create a commandline GUI. To wipe a window from the screen, you need to work out its area and fill it with the same color as your background to blank it out. Information only leaves the screen if it's overwritten
<julian__2>
that's what the fill_all method does
<julian__2>
the fill_all method takes one argument, @@color_pair
CoreData has quit [Ping timeout: 272 seconds]
<julian__2>
@@color_pair is the background color
<julian__2>
it's used in other parts of the program
<toretore>
can't you get the bg color from the window instance?
VTLob has quit [Quit: VTLob]
<julian__2>
what do you mean, pass it in as a parameter?
<toretore>
but anyway, you're defining the method in object, which is a no-no. you could define it in Window, but it's better to subclass to make your own class which has this capability
<toretore>
julian__2: no, the Window class.. does it not have something like a bgcolor attribute?
hogeo has quit [Remote host closed the connection]
mdedetrich has joined #ruby-lang
<julian__2>
toretor: I'll admit I'm slightly confused by the Curses library. Window.new is part of the curses library. And no, each window doesn't appear to have these attributes. I have to add them like this: