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
micalexander has quit [Remote host closed the connection]
micalexander has joined #ruby-lang
GarethAdams has quit [Ping timeout: 240 seconds]
GaelanAintAround is now known as Gaelan
micalexander has quit [Ping timeout: 272 seconds]
pothibo has quit [Quit: pothibo]
GarethAdams has joined #ruby-lang
GarethAdams has joined #ruby-lang
GarethAdams has quit [Changing host]
ikrima has joined #ruby-lang
majjoha has joined #ruby-lang
micalexander has joined #ruby-lang
micalexander has quit [Remote host closed the connection]
micalexander has joined #ruby-lang
tkuchiki has joined #ruby-lang
JoshuaPaling has joined #ruby-lang
majjoha has quit [Ping timeout: 240 seconds]
tkuchiki has quit [Remote host closed the connection]
tkuchiki has joined #ruby-lang
micalexander has quit [Ping timeout: 256 seconds]
yfeldblum has joined #ruby-lang
tkuchiki has quit [Ping timeout: 256 seconds]
mistym has quit [Quit: Leaving]
hogeo has joined #ruby-lang
zz_michael_mbp is now known as michael_mbp
RubyRookie has quit [Remote host closed the connection]
elia has quit [Quit: Computer has gone to sleep.]
flip_digits has quit [Remote host closed the connection]
hhatch has quit [Ping timeout: 240 seconds]
sepp2k1 has quit [Quit: Leaving.]
ruby-lang829 has quit [Ping timeout: 250 seconds]
stamina has quit [Ping timeout: 260 seconds]
yfeldblum has quit [Remote host closed the connection]
elia has joined #ruby-lang
elia has quit [Remote host closed the connection]
nertzy has joined #ruby-lang
tkuchiki has joined #ruby-lang
CaptainJet has quit [Ping timeout: 248 seconds]
CaptainJet has joined #ruby-lang
Barrin6 has joined #ruby-lang
Easy-Pete has joined #ruby-lang
<Easy-Pete>
What is the difference between instance_variable_get(:instvar) and instance_variable_get(instvar)
<Easy-Pete>
sorry
yfeldblum has joined #ruby-lang
CoreData has quit [Ping timeout: 272 seconds]
<Easy-Pete>
'instance_variable_get(:@instvar)'
<Easy-Pete>
and
<Easy-Pete>
'instance_variable_get(@instvar)'
<banisterfiend>
the latter probably doesn't do what u want
CoreData has joined #ruby-lang
lfox has joined #ruby-lang
lfox has quit [Client Quit]
lfox has joined #ruby-lang
<Easy-Pete>
banisterfiend What do you mean?
simoz has joined #ruby-lang
<banisterfiend>
Easy-Pete You want to pass it either a symbol or a string
lfox has quit [Client Quit]
<banisterfiend>
that contains the name of the ivar
tylersmith has joined #ruby-lang
lfox has joined #ruby-lang
Easy-Pete has quit [Ping timeout: 268 seconds]
julweber has quit [Remote host closed the connection]
julweber has joined #ruby-lang
woollyams has joined #ruby-lang
symm- has quit [Read error: Operation timed out]
robbyoconnor has quit [Ping timeout: 256 seconds]
Oloryn_lt2 has joined #ruby-lang
julweber has quit [Ping timeout: 248 seconds]
micalexander has joined #ruby-lang
micalexander has quit [Remote host closed the connection]
micalexander has joined #ruby-lang
micalexa_ has joined #ruby-lang
micalexander has quit [Read error: Connection reset by peer]
shinnya has quit [Ping timeout: 252 seconds]
dhruvasagar has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
majjoha has joined #ruby-lang
Cakey has joined #ruby-lang
jperry_ has quit [Quit: jperry_]
majjoha has quit [Read error: Operation timed out]
lfox has quit []
lfox has joined #ruby-lang
Guest90131 has joined #ruby-lang
Guest90131 is now known as diegoviola
JoshuaPaling has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Coincidental has quit [Remote host closed the connection]
Coincidental has joined #ruby-lang
julweber has joined #ruby-lang
michael_mbp is now known as zz_michael_mbp
Coincidental has quit [Ping timeout: 245 seconds]
julweber has quit [Ping timeout: 252 seconds]
Elico has quit [Ping timeout: 248 seconds]
spuk has quit [Quit: Human beings were created by water to transport it uphill.]
Elico has joined #ruby-lang
spuk has joined #ruby-lang
zz_michael_mbp is now known as michael_mbp
Domon has joined #ruby-lang
Coincidental has joined #ruby-lang
Oloryn_lt2 has quit [Read error: Connection reset by peer]
bzalasky has joined #ruby-lang
ldnunes has quit [Quit: Leaving]
_AJ has joined #ruby-lang
micalexander has joined #ruby-lang
simoz has quit [Ping timeout: 240 seconds]
<_AJ>
Anyone having issue installing gems using the —system ruby on Mavericks?
Oloryn_lt2 has joined #ruby-lang
<_AJ>
Anyone get it working without a version manager?
saarinen has quit [Quit: saarinen]
saarinen has joined #ruby-lang
micalexa_ has quit [Ping timeout: 268 seconds]
micalexander has quit [Ping timeout: 248 seconds]
micalexander has joined #ruby-lang
CaptainJet has quit []
micalexander has quit [Read error: Connection reset by peer]
micalexander has joined #ruby-lang
jonathanmarvens has quit [Read error: Connection reset by peer]
CaptainJet has joined #ruby-lang
jonatha__ has joined #ruby-lang
sevvie has joined #ruby-lang
sevvie has quit [Client Quit]
arooni-mobile has quit [Ping timeout: 260 seconds]
majjoha has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
mistym has joined #ruby-lang
majjoha has quit [Ping timeout: 248 seconds]
bzalasky has quit [Ping timeout: 264 seconds]
<havenwood>
_AJ: Works on my machine: sudo gem update --system
<havenwood>
_AJ: Oh, on second read looks you weren't asking about updating RubyGems, but same for gems. With `sudo` not seeing trouble.
<_AJ>
I had issue install rails, devise, jekyll. Just about any gem.
<_AJ>
I might do an Erase and Install has it was running the Developer preview for several months.
charliesome has joined #ruby-lang
slyphon has quit [Quit: I REGRET NOTHiiiiiiiiiinnnngggg….]
achiu1 has joined #ruby-lang
achiu has quit [Ping timeout: 240 seconds]
majjoha has joined #ruby-lang
robbyoconnor has joined #ruby-lang
yours_truly has quit [Quit: Leaving]
stardiviner has joined #ruby-lang
nisstyre has joined #ruby-lang
enmand has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
majjoha has quit [Ping timeout: 264 seconds]
woollyams has quit [Ping timeout: 252 seconds]
mistym_ has joined #ruby-lang
lupine has quit [Ping timeout: 245 seconds]
mistym has quit [Ping timeout: 245 seconds]
jithu has joined #ruby-lang
randym_ has quit [Ping timeout: 248 seconds]
shaileshg_ has quit [Ping timeout: 248 seconds]
Domon_ has quit [Ping timeout: 272 seconds]
bzalasky has joined #ruby-lang
r0bby_ has joined #ruby-lang
robbyoconnor has quit [Ping timeout: 245 seconds]
randym_ has joined #ruby-lang
r0bby_ has quit [Client Quit]
Domon_ has joined #ruby-lang
shaileshg_ has joined #ruby-lang
ikrima has quit [Ping timeout: 260 seconds]
lfox has quit [Quit: ZZZzzz…]
majjoha has joined #ruby-lang
Gaelan is now known as GaelanAintAround
majjoha has quit [Ping timeout: 248 seconds]
nisstyre has quit [Quit: Leaving]
tomzx_mac has quit [Read error: Operation timed out]
jj_reddit4 has joined #ruby-lang
<jj_reddit4>
Hey there! I got a CL application i'm building using thor. I want to be able to get an update on what I was last working on. Would I need a database like PG or is it more convenient to write it to a file and make it invisible?
dhruvasagar has quit [Ping timeout: 246 seconds]
pothibo has joined #ruby-lang
<_AJ>
If it's simple data, look into using sqlite
<Barrin6>
what's CL
<Barrin6>
craigslist?
<jj_reddit4>
command line application
<_AJ>
Command line
<Barrin6>
oh lol
pothibo has quit [Client Quit]
<_AJ>
SQLite is also pretty portable
<jj_reddit4>
the status is going to be like less than 140 characters at best in the directories i use it in
<_AJ>
Pretty easy to impliment if you already have some SQL chops
<jj_reddit4>
thanks _AJ
<jj_reddit4>
i'll take a look
<_AJ>
PG will be overkill
nisstyre has joined #ruby-lang
<_AJ>
You'll spend more time setting up the database than writing the app
soba has quit [Ping timeout: 265 seconds]
soba has joined #ruby-lang
mistym has joined #ruby-lang
<Barrin6>
i got no sql chops
<Barrin6>
I know how to write basic select queries
<Barrin6>
that's about it
vbatts has joined #ruby-lang
<Barrin6>
oh shit this is pretty good guide _AJ
mistym_ has quit [Ping timeout: 248 seconds]
soba has quit [Ping timeout: 240 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
majjoha has joined #ruby-lang
amerine has joined #ruby-lang
<Barrin6>
I could create my own facebook with sqlite
<hfp>
Evening all! I am trying to understand the following snippet: http://pastebin.com/THW9kdq8 . I understand why the first line is "Batman will win", but I don't understand why the second isn't "Batman will win" and then "Ironman will win". Why isn't the lambda executed in the second call?
<lianj>
it is
majjoha has quit [Ping timeout: 245 seconds]
<hfp>
So why isn't "Batman will win" output from that call?
kitak has quit [Remote host closed the connection]
<jrobeson>
somebody must have embedded lua in sqlite by now.
<jrobeson>
with that, you could have your own single file application
<hfp>
lianj: Thanks but I still don't understand...
bzalasky has quit [Remote host closed the connection]
<jrobeson>
sometimes you should skip ahead and come back
<jrobeson>
later*
bzalasky has joined #ruby-lang
<jrobeson>
in case more playing is required for true understanding
<Barrin6>
is this from code academy?
<hfp>
Barrin6: Yes
<Barrin6>
I honestly never understood it either
<Barrin6>
i went through that same tutorial
<Barrin6>
will probably have to go back to it again
<Barrin6>
hfp
<Barrin6>
from what I understand with lambda
<Barrin6>
if it's called upon, it will break out of the method
<Barrin6>
and when it breaks, it means it doesn't execute the rest of the method
<Barrin6>
don't ask why
<Barrin6>
I don't know
<hfp>
Barrin6: This is for procs I think. Lambdas are supposed to come back and execute the rest, no?
<Barrin6>
wait isn't that what you said? the lambda is not executing the rest?
<Barrin6>
or did I mix those up
bzalasky has quit [Ping timeout: 245 seconds]
<jrobeson>
they both handle return different, that is a fact
<hfp>
It's weirder than that. The lambda executes the second part (puts "Ironman..." but not the first part "Batman..." when I expected it to output both
<Barrin6>
i remember seeing a diagram that explained the difference
<jrobeson>
i haven't seen much of that in userland code.
<whitequark>
if you have a return statement in proc{} or just a raw block (eg each{}), it returns from the innermost method (def)
<whitequark>
if you have a return statement in a lambda{}, it returns just from that lambda.
<Barrin6>
userland code?
<jrobeson>
doesn't matter
<hfp>
whitequark: I get that, but then why the puts from the lambda isn't displayed at all in my snippet?
<whitequark>
hfp: there is no puts in your lambda
<hfp>
whitequark: True... But Ruby always prints a return, doesn't it?
<whitequark>
hfp: what? of course no
<whitequark>
return is just, well, return. in fact lambda { "foo" } is equivalent to lambda { return "foo" }
<Barrin6>
hfp, get ruby on your computer
<Barrin6>
and copy that code into a notepad and save as a .rb file
<Barrin6>
i'm 90% done with code academy but doing projecteuler helps me reinforce syntax
<Barrin6>
90% done with the ruby track on code academy*
<hfp>
whitequark: Ok I think I'm confused. >> foo = "bar"; foo will output "bar". I was told (seems I misunderstood) that it is why "return" aren't needed in 99% of the cases. What am I missing?
<heftig>
hfp: methods automatically return the value of the last expression evaluated
<whitequark>
hfp: that's just how a repl works
<whitequark>
if you don't execute that expression on its own line in a repl, there won't be anything printed.
havenwood has quit [Remote host closed the connection]
<heftig>
puts batman_ironman_lambda calls batman_ironman_lambda and uses its value as a parameter to puts
<heftig>
batman_ironman_lambda creates a lambda which returns "Batman...", then calls it. however, that return value is thrown away, since it's not used for anything
<hfp>
heftig: Aaaaah I think I'm starting to get it
<heftig>
the next expression is "Ironman...", which is also the last one
<heftig>
and that one becomes the return value
<hfp>
And instead it is overwritten by "Ironman..."
<hfp>
Ok makes sense now!
<heftig>
the key difference between _proc and _lambda here is that "return" in a proc returns from the enclosing context (the method) instead
<heftig>
while "return" in a lambda returns from the lambda
Coincidental has quit [Remote host closed the connection]
jj_reddit4 has left #ruby-lang [#ruby-lang]
<hfp>
Excellent I get it now
<heftig>
do in batman_ironman_proc, the victor.call returns from the method, so "Ironman..." is never evaluated
<heftig>
so in*
GaelanAintAround is now known as Gaelan
Coincidental has joined #ruby-lang
<hfp>
Yup
majjoha has joined #ruby-lang
<hfp>
Thanks :)
<hfp>
Barrin6: did you get this?
jonathanmarvens has quit [Remote host closed the connection]
<Barrin6>
sorry was away
<Barrin6>
what I miss
Gaelan is now known as GaelanAintAround
kdonrails has joined #ruby-lang
<hfp>
Barrin6: That in the lambda, it doesn't puts "Batman...." because the return is overwritten by "Ironman..."
Coincidental has quit [Ping timeout: 252 seconds]
majjoha has quit [Ping timeout: 264 seconds]
postmodern has joined #ruby-lang
havenwood has joined #ruby-lang
<Barrin6>
o9hh
<Barrin6>
so that's it?
<Barrin6>
lambda returns the latest return?
<hfp>
No
<Barrin6>
oh
<Barrin6>
you just substitued by doing victor.call followed by the string
<Barrin6>
and that string replaces
<Barrin6>
what was in the original lambda
<Barrin6>
right?
<Barrin6>
no I don't understand
<hfp>
The lambda returns something but then the methods returns something else. If somewhere just after the victor.call there was a line of code doing something with the string "Batman" returned from the lambda, we would see it. But nothing is done and so the final evaluation of the whole method returns "Ironman" only and that's what puts outputs
<hfp>
If you add a puts to victor.call then you see it
<Barrin6>
okay one sec I need to copy your code into my own ruby
<Barrin6>
and run it
<Barrin6>
okay so I added the puts to victor.call
<Barrin6>
now it prints both out
<Barrin6>
i mean puts all 3 out
<Barrin6>
but both from the lambda method
<hfp>
Do you understand why now?
<Barrin6>
what do you mean nothing is done?
<Barrin6>
and so the evaulation of the whole method returns "Ironman"
<hfp>
The lambda returns "Batman..."
<Barrin6>
yea it's supposed to
<Barrin6>
but method returns iron man
<hfp>
But the rest of the code doesn't use this return and instead the next instruction is to return "Ironman..."
<hfp>
try and put "return victor.call" instead of "puts victor.call"
<hfp>
Or remove "Ironman..." which is essentially the same
<hfp>
And it will show "Batman..."
<Barrin6>
okay yea I get that part kinda
<Barrin6>
I think it's one of those things I will have to go back to
<Barrin6>
and maybe get it down later
<hfp>
I guess
<hfp>
Oh well heftig's explanation made sense for me I thought it would for you too
<Barrin6>
:(
<Barrin6>
I'm not that smart
huma has joined #ruby-lang
<hfp>
It's not about being smart it's just that different explanations make sense to different people
soba has joined #ruby-lang
<Barrin6>
Only thing I know is that proc ignores the # of arguments
<Barrin6>
where as lambda is strict on them
CaptainJet has quit []
<hfp>
Yes
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby-lang
<hfp>
Keep asking to get different answers Barrin6. I got a few answers before it made sense.
<Barrin6>
Yea I have to review it later on
<Barrin6>
there is a lot of resources on it
robbyoconnor has joined #ruby-lang
<Barrin6>
thanks for trying
<hfp>
Sure, I hope you figure it out too :)
diegoviola has quit [Ping timeout: 256 seconds]
<Barrin6>
anyone know why this is stuck in a long loop. If I change the 500 to 5 it's quick
<maloik>
disclaimer: I never download illegal shit, dear NSA, promise!
tbuehlmann has joined #ruby-lang
<ljarvis>
+1
arBmind has quit [Quit: Leaving.]
<workmad3>
maloik: I doubt the NSA cares if you download tv shows... that's RIAA and MPAA and their ilk
hahuang65 has quit [Ping timeout: 260 seconds]
<ljarvis>
I used to enjoy downloading movies and the hours it took to encode them and add them to itunes, but i got tired of it and stopped
<maloik>
oh you'll still need to do that of course
<maloik>
most stuff is mkv these days
<ljarvis>
yeah i mean im thinking of starting again
<workmad3>
isp blocks are being put in because of crappy copyright censorship lobbying
<ljarvis>
i went to the movies last week
<maloik>
but you can pass video through and only encode audio, which means it only takes like 10min for a proper movie
<ljarvis>
the price is insane, i feel so old
arBmind has joined #ruby-lang
<workmad3>
ljarvis: it really is :(
<whitequark>
try vpns
<whitequark>
there are some high-performance ones
<workmad3>
ljarvis: although the cinema my wife and I tend to use isn't too bad... less than £5 for a ticket before 12, goes up to about £6 for most of the rest of the time and £7 for peak times
<ljarvis>
workmad3: that's really good, it's like 9 here
<ljarvis>
workmad3: at any time
<workmad3>
ljarvis: and they give a free refill on large drinks and large popcorn, which makes seeing two films back-to-back less costly
<ljarvis>
workmad3: wow :/
<ljarvis>
workmad3: where is that?
enmand has joined #ruby-lang
<workmad3>
ljarvis: yeah, that's the odeon prices in the other 2 cinemas nearby
<workmad3>
ljarvis: amc cinema in manchester
<ljarvis>
yeah odeon is a little cheaper, but ours sucks so bad so i end up at vue
<ljarvis>
nothing cheaper than odeon here :(
<workmad3>
yeah, those two odeons suck too (trafford centre and printworks... crappy layout, crappy seats, much more expensive for everything)
<ljarvis>
ah yeah i've been to the odeon in the trafford centre
nofxx has quit [Ping timeout: 240 seconds]
<ljarvis>
funnily enough, that's still better than the one here
<workmad3>
we managed to get a refund on tickets there once because it was so crap
<ljarvis>
hah
<workmad3>
kids talking all the way through, despite multiple complaints, and my wife's drink went and leaked all over her
<ljarvis>
:(
<ljarvis>
cinemas are not what they were
<workmad3>
I think it was HP6 though... so the film was shit anyway :)
<ljarvis>
I remember when i could go for a fiver and have a drink, with change
<workmad3>
hehe, next you'll be complaining about how cream eggs used to be bigger, along with mars bars, twixes, big macs...
<ljarvis>
yes all of those things
<workmad3>
:)
<maloik>
I think I remember 2.5 euro movies
<maloik>
good times
<maloik>
it's about 8.5 here now I believe for an adult at all times
<maloik>
and all snacks are crazy expensive
<workmad3>
maloik: really? the euro has been around for long enough that a cinema trip was that cheap under it?
<maloik>
2000 or 2001 in belgium if I recall
<maloik>
I think I was 12 so yea 13 years roughly
enmand has quit [Ping timeout: 272 seconds]
<darix>
workmad3: for germany i can say ... for many things you now pay the same digit in euros that you paid in the old currency
<maloik>
was a shitty local place mind you, haven't been there in 5 years or so so not sure what prices are there now, but they probably exploded as well
<mlangenberg>
Guys, I have an Client class that initializes a TCPSocket. I do have an explicit 'close' method defined, to close the socket. But what if someone forgets? Is there a way to close the socket when the process exits?
<darix>
mlangenberg: when the process closes it will be all cleaned up
<workmad3>
mlangenberg: does the socket definitely get left open if the process exits or aborts?
<ljarvis>
mlangenberg: the socket will close when the process exists
<darix>
but you can hook on atexit or so
<ljarvis>
and you shouldn't be worrying about "what if someone forgets"
<ljarvis>
that's not your job
<workmad3>
mlangenberg: I'd also suggest providing a block-style version that scopes the socket, similar to File.open {|f| ...}
<ljarvis>
^
<ljarvis>
about to suggest that
<workmad3>
:)
<ljarvis>
definitely the best apprach
<ljarvis>
apprach
<ljarvis>
definitely
julweber has quit [Remote host closed the connection]
<workmad3>
mlangenberg: then you can yield to the block and have an 'ensure my_socket.close'
<mlangenberg>
Similar case to this.
julweber has joined #ruby-lang
<mlangenberg>
Imagine POOL = Array.new(10) { TCPSocket.new(host, port) }
<workmad3>
mlangenberg: ah, so you're worried about a worker in a long-running process grabbing a connection and never releasing it
<mlangenberg>
Should I worry about closing those connections?
<workmad3>
mlangenberg: for that, I'd suggest that you don't let a work grab its own connection... you pass in a connection and free it up again
<workmad3>
*worker
<mlangenberg>
Actually, I want to make sure the shutdown of the long-running process doesn't keep an orphaned socket connection around.
<workmad3>
mlangenberg: to be a good citizen, you should close all your sockets when closing down
<mlangenberg>
block-style api is not usable in this case.
<workmad3>
mlangenberg: however, they will be freed up when ruby closes down too
<mlangenberg>
what about a TRAP('INT') ?
<mlangenberg>
oh ok
<mlangenberg>
e.g. you are the author of Dalli::Client, how would you make sure it closes its connections when closing down?
<workmad3>
mlangenberg: you should free them up yourself so you can do a graceful shutdown (e.g. send proper close signals on active connections)
julweber has quit [Ping timeout: 240 seconds]
<workmad3>
or write logs, etc... graceful shutdown stuff :)
<workmad3>
mlangenberg: it depends on how you're planning on it being used
<workmad3>
mlangenberg: if you intend another coder to create an instance and use it as they see fit, then it's their job to ensure they clean it up
<yorickpeterse>
TIL >= is the same as ==
<yorickpeterse>
ensure_css_present!('.review_ratings li.rating', review_html, count: 4) results in an error with [".review_ratings li.rating", "should be >= 4"]
<yorickpeterse>
....there are 5 items
<yorickpeterse>
it checks with ==
<yorickpeterse>
fucking code
<workmad3>
mlangenberg: if you're instead providing a more structured framework where you're owning all the resources and passing them into callbacks etc that the other coder provides, then you should be able to to various 'ensure' blocks and add your own signal handlers to ensure cleanup is done
<mlangenberg>
ok
<workmad3>
yorickpeterse: hehe :) so the error message is wrong
<mlangenberg>
So in case someone decides to use this in Sidekiq, he should use Sidekiq on_shutdown callbacks to close all (in this example) Dalli::Client connections in the pool.
<workmad3>
mlangenberg: from what you've implied, it seems you're not doing the framework stuff though... you're passing ownership of the created client to the coder and therefore it's their job to make sure any 'close' calls are made
<workmad3>
mlangenberg: yeah :)
<mlangenberg>
gotcha
nofxx has joined #ruby-lang
<workmad3>
mlangenberg: trying to do it yourself at that point could easily step on the other coder's toes (e.g. they trap an INT themselves to do something like provide a console into the running system, but your handler goes and kills their clients behind the scenes)
mlangenberg has quit [Quit: mlangenberg]
julweber has joined #ruby-lang
hahuang65 has joined #ruby-lang
hahuang65 has quit [Ping timeout: 246 seconds]
Domon has quit [Remote host closed the connection]
arBmind has quit [Quit: Leaving.]
melter has quit [Ping timeout: 245 seconds]
axsuul has quit [Ping timeout: 245 seconds]
h_kon has quit [Remote host closed the connection]
skade has quit [Quit: Computer has gone to sleep.]
skade has joined #ruby-lang
havenwood has quit [Ping timeout: 264 seconds]
skade has quit [Client Quit]
workmad3 has quit [Ping timeout: 248 seconds]
CaptainJet has joined #ruby-lang
ruby-lang397 has joined #ruby-lang
workmad3 has joined #ruby-lang
breakingthings has quit []
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
saarinen has joined #ruby-lang
cnivolle has quit [Read error: Connection reset by peer]
cnivolle_ has joined #ruby-lang
ruby-lang927 has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
wallerdev has quit [Quit: wallerdev]
workmad3 has quit [Ping timeout: 265 seconds]
breakingthings has joined #ruby-lang
workmad3 has joined #ruby-lang
nignaztic has quit [Ping timeout: 252 seconds]
Mon_Ouie has joined #ruby-lang
majjoha has quit [Ping timeout: 245 seconds]
<ruby-lang397>
Question from a Ruby newbie: I'm trying to figure out why this code won't work. http://pastebin.com/m5NAp1mB (It should return the sum of the cubed numbers in the array [a..b].) The error msg I get says ** is not a method.
sevvie has quit [Read error: Connection reset by peer]
bzalasky has joined #ruby-lang
specialblend has quit [Quit: specialblend]
<mistym>
mlangenberg: Yep
ninjago has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
Asher has joined #ruby-lang
bzalasky has quit [Ping timeout: 240 seconds]
arBmind has left #ruby-lang [#ruby-lang]
mmorga has joined #ruby-lang
<mlangenberg>
Awesome, tests green
mlangenberg has left #ruby-lang [#ruby-lang]
yfeldblum has quit [Remote host closed the connection]
jsullivandigs has quit [Remote host closed the connection]
jsullivandigs has joined #ruby-lang
hahuang65 has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
Mon_Ouie has quit [Changing host]
Mon_Ouie has joined #ruby-lang
mistym is now known as mistym_lunch
mark06 has joined #ruby-lang
<mark06>
how can I make eval bring local variables to where it has been called from?
<mark06>
I don't want to use $global_vars
jsullivandigs has quit [Ping timeout: 265 seconds]
<r0bglees0n>
mark06: binding.eval("local_name")
rickhull has quit [Quit: Leaving.]
Mon_Ouie has quit [Ping timeout: 260 seconds]
<mark06>
I don't get it
<mark06>
the eval will parse many local vars
<mark06>
the text contains many local vars
<whitequark>
mark06: so you want eval("foo = 1"); foo ?
cored has quit [Ping timeout: 252 seconds]
<mark06>
whitequark: no, foo, bar,baz etc... all are on a single file
<mark06>
whitequark: I want the same effect as putting $ in the beginning
<whitequark>
try posting an example
<whitequark>
of your expected behavior
yfeldblum has joined #ruby-lang
<mark06>
file contents:
<mark06>
foo =1
<mark06>
bar=2
<mark06>
baz=3
<mark06>
then I read file
<mark06>
then I eval its contents
mistym has joined #ruby-lang
<mark06>
expected: these three vars be available after eval
<mark06>
what happens in fact: they are not
<mark06>
workaround: put $ in the beginning of them:
<mark06>
$foo=1
<mark06>
$bar=2
<mark06>
$baz=3
CoreData has quit [Quit: CoreData]
<mark06>
then they are available after eval as $foo, $bar, $baz
<mark06>
I want that, except that I don't want to make them global
CoreData has joined #ruby-lang
CoreData has quit [Client Quit]
CoreData has joined #ruby-lang
wallerdev has joined #ruby-lang
Coincidental has joined #ruby-lang
MaddinXx has joined #ruby-lang
nazty has joined #ruby-lang
nazty has quit [Read error: Connection reset by peer]
relix has joined #ruby-lang
MaddinXx has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
hotpancakes has joined #ruby-lang
rue has joined #ruby-lang
MaddinXx has joined #ruby-lang
Asher has quit [Quit: Leaving.]
benanne has joined #ruby-lang
mbj has quit [Ping timeout: 272 seconds]
cored has joined #ruby-lang
cored has quit [Changing host]
cored has joined #ruby-lang
stamina has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
Easy-Pete has quit [Quit: Lost terminal]
yfeldblum has joined #ruby-lang
yfeldblum has quit [Remote host closed the connection]
imperator has joined #ruby-lang
mmorga has quit [Remote host closed the connection]
mmorga has joined #ruby-lang
enebo has joined #ruby-lang
enmand has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ikrima has quit [Quit: Computer has gone to sleep.]
jackhammer2022 has joined #ruby-lang
retro|cz has quit [Ping timeout: 240 seconds]
ldnunes has quit [Quit: Leaving]
<drbrain>
mark06: eval cannot create local variables in the outer scope
<drbrain>
mark06: the outer scope has already been parsed and the local variable names decided
ecnalyr has joined #ruby-lang
<mark06>
:(
<mark06>
I ended up writing a small parser
ecnalyr has quit [Remote host closed the connection]
enmand has joined #ruby-lang
mistym has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
nazty has joined #ruby-lang
Coincidental has quit [Remote host closed the connection]
tough_griff has joined #ruby-lang
<whitequark>
mark06: btw, if you want a full ruby parser, "gem install parser".
Coincidental has joined #ruby-lang
huma has quit [Ping timeout: 240 seconds]
jhulten has joined #ruby-lang
nazty has quit [Client Quit]
nazty has joined #ruby-lang
mmorga has quit [Remote host closed the connection]
vlad_starkov has joined #ruby-lang
Coincidental has quit [Ping timeout: 272 seconds]
mr_red has quit [Ping timeout: 241 seconds]
hotpancakes has quit [Remote host closed the connection]
mistym_lunch is now known as mistym
mr_red has joined #ruby-lang
hotpancakes has joined #ruby-lang
Coincidental has joined #ruby-lang
__butch__ has joined #ruby-lang
enmand has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
hotpancakes has quit [Remote host closed the connection]
ldnunes has joined #ruby-lang
kevinfagan has quit [Ping timeout: 260 seconds]
hotpancakes has joined #ruby-lang
iraja has joined #ruby-lang
apeiros has joined #ruby-lang
nathanstitt has quit [Ping timeout: 240 seconds]
kek has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
bzalasky has joined #ruby-lang
enmand has joined #ruby-lang
MaddinXx has quit [Remote host closed the connection]
kurko_ has quit [Ping timeout: 265 seconds]
cored has quit [Ping timeout: 252 seconds]
nathanstitt has joined #ruby-lang
bzalasky has quit [Ping timeout: 256 seconds]
fragamus has joined #ruby-lang
ruby-lang397 has quit [Ping timeout: 250 seconds]
tough_griff has quit [Quit: computer went to sleep.]
<r0bglees0n>
mark06: ruby use to have what was suppose to be a bug, so that TOPLEVEL_BINDING.eval("xxx") could access locals from another script. it may have been fixed and probably not a good idea to rely on it either
vlad_sta_ has joined #ruby-lang
jackhammer2022 has quit [Quit: Computer has gone to sleep.]
kek has quit [Remote host closed the connection]
vlad_starkov has quit [Read error: Connection reset by peer]
kek has joined #ruby-lang
iraja has quit [Remote host closed the connection]