<andrewvos>
Hmmm, so eval passing in some object __binding__ seems to be what I'm after.
replore joined #ruby-lang
setmeaway joined #ruby-lang
sulo joined #ruby-lang
tomzx joined #ruby-lang
havenn joined #ruby-lang
macmartine_ joined #ruby-lang
<perryh->
hey, I'm trying to convert the string "008" into an integer by type casting it, but I am getting an error "invalid value for Integer(): "008""
<erikh>
that's because 008 isn't an integer
<perryh->
but it is working for "001", "002", etc
<erikh>
oh,w ow
<shevy>
hmm
<erikh>
that's principle of most surprise :)
<erikh>
those are octal notation
<erikh>
that's why 008 doesn't work
<erikh>
trim the zeroes. thank me later.
<perryh->
cool, thank you
<injekt>
if you want an integer from that string you want to_i
<injekt>
Integer('010') #=> 8
<injekt>
'010'.to_i #=> 10 (probably what you want)
<Asher>
hahah i hope it reads better than google translation
nuclearsandwich joined #ruby-lang
thone joined #ruby-lang
porcelina joined #ruby-lang
srbartlett joined #ruby-lang
srbaker joined #ruby-lang
dreinull joined #ruby-lang
ilyam joined #ruby-lang
twittard joined #ruby-lang
robbyoconnor joined #ruby-lang
srbartlett joined #ruby-lang
zedUNDginger joined #ruby-lang
ecin joined #ruby-lang
looopy joined #ruby-lang
<Xzyx987X>
although this may seem like an insane idea (as most of my ideas do), I was wondering if the ruby gods of metaprogramming have provided us with a way to take a reference to a class, and use it to get the complete definition of that class?
<Asher>
what do you want to know
<Asher>
you want source code? or you want to know what methods it provides and such
<Xzyx987X>
source code
<injekt>
no
<Asher>
ask banistergalaxy about that he's hooked up pry to look up source… i think ruby just provides the location tho built in
<lianj>
1.9 has method(:foo).source_location
<injekt>
'source code'
<Xzyx987X>
what if the class was defined dynamically, as in an irb type environment?
<injekt>
Xzyx987X: no, you need to parse the source code
<zedUNDginger>
Xzyx987X: if you want method source, that's possible, but it's much harder and may not even make sense in the case of classes
<zedUNDginger>
Xzyx987X: the reason it may not make sense for classes is they can be reopened and monkeypatched in any number of files, so there's not just a single definition
<Xzyx987X>
yea, that's what I thought. maybe I need to figure out a way to detect a class definition on the fly and just save it when it happens
<zedUNDginger>
Xzyx987X: but it definitely makes sense for methods, and you can get method source
<injekt>
save what?
gnufied joined #ruby-lang
<porcelina>
what is even the underlying data type for a method?
<porcelina>
is it bytecode?
dave_miles_cf joined #ruby-lang
<Xzyx987X>
by the way, this is for little project I'm doing to let people write their own adventure games in ruby
<porcelina>
lol doesn't ruby let people write their own adventure games in ruby? :v
x0F_ joined #ruby-lang
<zedUNDginger>
x0F_: hello
Wardrop_ joined #ruby-lang
<Xzyx987X>
eh, my idea kind of let's people combine their adventures with those written by other people
<porcelina>
oh, that's pretty cool
<zedUNDginger>
has anyone found a way to make testing fun
<porcelina>
name all your mocks funny things?
<Xzyx987X>
it basically creates a combination between an adventure game an wikipedia
<porcelina>
;o
<porcelina>
actually that sounds really cool
<Xzyx987X>
yea, so nobody steal my idea til it's done ;P
<lianj>
zedUNDginger: text-to-speech the output?
<injekt>
lol
<Wardrop_>
Can someone remind me how I can partition a flat array (e.g. ['dog', 'cat', 'horse', 'mouse', 'rat', 'zebra']) into pairs such as [['dog', 'cat'], ['horse', 'mouse'], ['rat', 'zebra']]]
<injekt>
that would be annoying
<zedUNDginger>
Wardrop_: each_slice(2).to_a should do it
<porcelina>
Hash[array].to_a might do it...
<injekt>
both work, you should use each_slice
<porcelina>
yeah mine's stupid lol don't use it
<zedUNDginger>
porcelina: lulzy
<porcelina>
i think i've seen people use it tho. o_o
<zedUNDginger>
porcelina: that's cute
<zedUNDginger>
porcelina: did you just come up with that now
<injekt>
it's not stupid, it just does too much work
<injekt>
pointless work*
<injekt>
so why did I only learn about _ in irb this week?
<injekt>
that's retarded
<zedUNDginger>
man ruby is going to so badass when we get that 'lazy' method on Enumerable
<porcelina>
what's _ in irb?
<injekt>
porcelina: try it?
<lianj>
injekt: hihi
<zedUNDginger>
to be*
<injekt>
zedUNDginger: 'when'?
<zedUNDginger>
injekt: probably 2.0
<porcelina>
oh, it's like perl's $_?
<injekt>
porcelina: no
<injekt>
zedUNDginger: eh, with all existing methods?
<zedUNDginger>
injekt: not quite sure what u mean but ill look up and see if i can find when matz talked about
srbartlett joined #ruby-lang
<injekt>
zedUNDginger: will we get lazy ranges? ;)
edwardsharp joined #ruby-lang
igotnolegs joined #ruby-lang
<zedUNDginger>
injekt: all Enumerable methods will have lazy variants, so you'll get shit like: (1..Infinity).lazy.select(:even?).map { |v| v ** 2 }.take(20)
<headius>
you don't have to tweak the jvm much for jruby to be nice
<headius>
we do a lot of that ahead of time
<injekt>
a wild headius appears
<slyphon>
no, jruby is not giving me trouble
<jmontross>
well i did that in the above pastie and it did not do anything
perryh_ joined #ruby-lang
perryh_ joined #ruby-lang
<slyphon>
i read that "my favorite flags" blog post and took heed
<jmontross>
i'm also not high. it is a weekday.
<injekt>
jmontross: no you didn't
<injekt>
jmontross: you didn't use __method__ inside of the method body
<jmontross>
inject: true - i did not do the def foo; p __method__; end
pabloh joined #ruby-lang
<headius>
hmm, have I had too much wine to wire instance variables up to invokedynamic....
<injekt>
injekt* and yes, perhaps you should have :)
<injekt>
headius: oh my
<slyphon>
hah
<injekt>
headius: I would like to say put the bottle down, but.. drink more and do more whacky things!
<headius>
I do my best work under the influence
<slyphon>
injekt: someone was telling me recently that one of the core MRI committers is *always* drunk while writing
<injekt>
Don't we all :D
<injekt>
apart from drivers
<injekt>
that's a bad idea
<slyphon>
indeed
<slyphon>
Kids, Don't Drink and Drive
<deryl>
hehe debugging under 1.9.3-p0 is funny. A) i have all the gems installed and bundled that my app depends on. B) when i run ruby --debug <command_im_debugging> (or prefixed with bundle exec) i get tons of cannot load such files and uninitialized constant errors. but the program runs even though it said it couldn't find the files it depends on.
<jmontross>
okay- here is example of thte __method__ magicalness with a class method- http://pastie.org/2937006
<jmontross>
thanks inject
<injekt>
injekt*
<injekt>
that's twice
<injekt>
3 strikes and..
<injekt>
i dont know
<deryl>
rubygems.rb:1252 - cannot load such file -- rubygems/defaults/ruby and rubygems/custom_require.rb:36 - cannot load such file -- pry
<jmontross>
injekt me with your proper spelling
<jmontross>
goodnight
<lianj>
jmontross: puh and i thought my example was clear ;)
<slyphon>
injekt: mockery?
<deryl>
stuff like that. for the pry, i have the gem installed and regardless if i run ruby --debug or bundle exec ruby --debug it complains it cant find the gems. but if i run it without --debug it all runs fine.
<injekt>
slyphon: exactly
<deryl>
weird.
<slyphon>
deryl: that might be gem debug output?
<slyphon>
like, rubygems might be doing something lazy
<slyphon>
that's causing a warning
<slyphon>
i mean, i know you're supposed to run ruby w/ -w and shit, but man, that crap gets noisy and annoying
<jmontross>
this could have all been avoided if I'd read higher on the thread. I started at "__method__" is magic.
<Xzyx987X>
not sure if that's the direction I'll go in, but it's good to know
<jmontross>
lianj - your example was clear though i took it out of concept as magic in no context… i imagined it to be more magical.
<injekt>
porcelina: yeah most people do, even i do sometimes
<edwardsharp>
omg, /nick dotmatrix
gregmoreno joined #ruby-lang
<jmontross>
but that is really a cool variable : __method__
<porcelina>
Xzyx987X: now i'm curious if there's something like save_lisp_and_die for ruby
<slyphon>
edwardsharp: yeah, you should hear how much *less* noise injekt makes than that guy
livinded joined #ruby-lang
<injekt>
haha
<injekt>
lets agree all printers suck and none of them work
<edwardsharp>
no way! i saw one work at the store once!
<slyphon>
they work, but only when *they* want to
<slyphon>
they are evil evil bastards
<injekt>
the store ones work
<injekt>
then you buy one
<injekt>
and well, it doesn't
<edwardsharp>
:D usb 6.66
<lianj>
jmontross: def a; p [:methods, :instance_variables, :local_variables].map{|i| send(i).grep(:__method__) }; end; p a # :P
<lianj>
jmontross: a hint: its a methods ;)
<jmontross>
i luckily had a hash i defined as a earlier in my irb session
<jmontross>
magical
<jmontross>
you know some g ood magic tricks… what is this one called?
kitallis joined #ruby-lang
tallship joined #ruby-lang
zmack joined #ruby-lang
<injekt>
:/
<injekt>
if you're not in #ror, you missed the fun
jmontross left #ruby-lang
<shevy>
injekt under linux, printers do indeed suck :(
<injekt>
shevy: and if you're under windows, you have bigger problems
<ryanf>
injekt: yeah? what fun?
<injekt>
ryanf: I was referring to all of the 'injekt' related nick changes
<ryanf>
ahh
<porcelina>
Finished in 2.95 seconds
<porcelina>
68 examples, 30 failures
<porcelina>
gggggg someone shoot me. =_=
<injekt>
better than 50%!
<porcelina>
that's just this service. ^_^
<porcelina>
there's still a bunch that are at 0%
<lianj>
at least there are tests to check
<shevy>
injekt so far all printers I had worked under windows. I remember my canon i320 didn't have a linux printer some years ago, though a commercial driver was available... but paying like 30 euros just for software felt awkward given that that canon printer was super-cheap (like 50 euro or something in total)
<injekt>
wall'o'text
<porcelina>
there's tests to check because i wrote tests to check lol
<lianj>
^^
zedUNDginger joined #ruby-lang
jmcphers joined #ruby-lang
mitchty joined #ruby-lang
WillMarshall joined #ruby-lang
yumike joined #ruby-lang
ecin joined #ruby-lang
macmartine joined #ruby-lang
srbaker joined #ruby-lang
ecin_ joined #ruby-lang
<macmartine>
What's the best Ruby book, for intermediate -> advanced?
<macmartine>
zedUNDginger: ok, i heard kinda bad things about that. but i'll take a look. thanks
<ryanf>
haha
<ryanf>
I have only heard good things about refacotinr
<ryanf>
well, certainly no bad ones
<macmartine>
i have the original Fowler Refactoring book and read somewhere that the Ruby edition was a Ruby edition that wasn't thoroughly thought out. But I don't remember the source so I'll take a gander
Defusal joined #ruby-lang
Defusal joined #ruby-lang
ksinkar joined #ruby-lang
yxhuvud joined #ruby-lang
steph021 joined #ruby-lang
steph021 joined #ruby-lang
steph021 joined #ruby-lang
steph021 joined #ruby-lang
steph021 joined #ruby-lang
steph021 joined #ruby-lang
steph021 joined #ruby-lang
steph021 joined #ruby-lang
io_syl joined #ruby-lang
io_syl joined #ruby-lang
SuperTaz joined #ruby-lang
burgestrand joined #ruby-lang
JohnBat26 joined #ruby-lang
michael_mbp joined #ruby-lang
io_syl joined #ruby-lang
io_syl joined #ruby-lang
srbaker joined #ruby-lang
kitallis joined #ruby-lang
thrcka joined #ruby-lang
mytrile joined #ruby-lang
bousquet joined #ruby-lang
zedUNDginger joined #ruby-lang
<yango>
I expect to be missing something. I have an @array variable in my method.I want to implement each for the class that will return one element of the array at a time, the problem is I'm keeping a count of the next row to return, this feels awkward in Ruby, am I not missing something? I have def each; @cur_row += 1; yield @array[@cur_row]; end
<zedUNDginger>
yango: def each: @array.each { |v| yield v }; end
<yango>
then I could just do def each(&blk) @array.each &blk
<yango>
no?
<zedUNDginger>
yango: Yeah
<zedUNDginger>
probably return 'self' after though
<yango>
but, if I want to create an object from each item on the each call I would have to use the first idiom? { |v| yield Item.new(v) }
<yango>
(or store the objects in the array in the first place)
paul0` joined #ruby-lang
<zedUNDginger>
yango: ill be back soon im going to go buy some lollies to eat
Mchl joined #ruby-lang
gnufied joined #ruby-lang
zedUNDginger joined #ruby-lang
JohnBat26 joined #ruby-lang
nuclearsandwich joined #ruby-lang
woollyams joined #ruby-lang
publicvoid joined #ruby-lang
mytrile_ joined #ruby-lang
[zaf]-Coral joined #ruby-lang
ryanf joined #ruby-lang
solars joined #ruby-lang
kitallis joined #ruby-lang
robotmay joined #ruby-lang
skim1776 joined #ruby-lang
Wardrop_ joined #ruby-lang
burgestrand joined #ruby-lang
<edwardsharp>
yes! i just got paid to install rvm!
* edwardsharp
considers pledgie
dc5ala joined #ruby-lang
thrcka joined #ruby-lang
roadkith joined #ruby-lang
roadkith_ joined #ruby-lang
roadkith joined #ruby-lang
roadkith joined #ruby-lang
<shevy>
edwardsharp ??? paid to install rvm? why?
<shevy>
oh wait
<shevy>
you mean, on another system or?
cyri_ joined #ruby-lang
<shevy>
or do you mean on your system
<edwardsharp>
um, on another system. i mean not so extraordinary that someone called me and was like, hey install rvm... but moreso like it was apart of this larger rails project that i bill time for...
molgrew joined #ruby-lang
<shevy>
kkk
<shevy>
now it makes a lot more sense
<edwardsharp>
yeah, i'm usually rather convoluted...
<shevy>
the best thing while coding is
<shevy>
the getting-drunk part
pcwormald joined #ruby-lang
<shevy>
and for proper motivation, you can only drink after you finished coding something small-ish
<shevy>
like at least a method that does something useful
<Asher>
at least during the ballmer peak
skim1776 left #ruby-lang
yorickpeterse joined #ruby-lang
<edwardsharp>
Spaceghost: obviously.
apeiros|work joined #ruby-lang
<apeiros|work>
good morning
<apeiros|work>
I'm trying to compile ruby 1.9.2 on osx lion as 32bit, but I get a 64bit ruby instead.
<apeiros|work>
edwardsharp, that happens when I put the env vars at the end of the invocation
<edwardsharp>
oh, so you get an error for every VAR declaration.
<edwardsharp>
hmm.
<edwardsharp>
what about in .rvmrc?
<apeiros|work>
I doubt that'll change anything, it'll still be loaded as env vars. but lets see…
<apeiros|work>
still Mach-O 64-bit executable x86_64
zmack joined #ruby-lang
<shevy>
hmm
<shevy>
load './test' # all works without .rb extension as the file name
<matti>
Asher: :-)
<shevy>
load 'test.rb' also works
<shevy>
load 'test' however does not work hmm
robotmay joined #ruby-lang
sepp2k joined #ruby-lang
Banistergalaxy joined #ruby-lang
jensn joined #ruby-lang
adambeynon joined #ruby-lang
tijmencc joined #ruby-lang
Diaoer joined #ruby-lang
yorickpeterse joined #ruby-lang
benanne joined #ruby-lang
workmad3 joined #ruby-lang
tijmencc joined #ruby-lang
yorickpeterse1 joined #ruby-lang
kitallis joined #ruby-lang
heftig joined #ruby-lang
[zaf]-Coral joined #ruby-lang
yfeldblum joined #ruby-lang
ksinkar_ joined #ruby-lang
workmad3_ joined #ruby-lang
dave_miles joined #ruby-lang
misconosciuto joined #ruby-lang
<shevy>
hmmmm
<shevy>
when I have a method that does not exist
<shevy>
for instance, blablablablabllalala() in a file that is required
<shevy>
ruby stops loading that file
<shevy>
all code stuff that is "seen" before that invalid call can however be used
<shevy>
I can rescue the error too: rescue NameError => error
<shevy>
but I can't continue loading that file
<shevy>
Is it somehow possible to say "Ok, that's an invalid call ... but we rescued it anyway, silently, and we continue reading the rest of the ruby file in question no matter what." ?
<apeiros|work>
not like that, no
<apeiros|work>
you can use some method_missing hack to ignore the missing method call, or you can use eval + the backtrace
<apeiros|work>
but those are both ugly hacks
* apeiros|work
gotta switch networks, off for now
yfeldblum joined #ruby-lang
<shevy>
hmm
<shevy>
if I wouldn't hate eval so much ... :(
<erikh>
the hate is healthy, the pragmatist should know when to use it though.
<yfeldblum>
eval is evil; why do you hate it?
<erikh>
heh
<shevy>
I find all the eval*s to be really ugly to read and look at.
<erikh>
not sure how you expect to get any better if you avoid the ugly things
<shevy>
ok
<shevy>
every time I use @@ from now on, I will comment it with # erikh thinks this is good
<erikh>
no, don't misread what I said
<erikh>
judicious use of something just acknowledges that it's the appropriate technique for a particular task
<Banistergalaxy>
Eval is my friend
<erikh>
that doesn't mean it's pretty, or ugly. those constructs exist for a reason and better to learn and understand what those cases are than fear and avoid them because they aren't furry, small and soft
<Banistergalaxy>
Erikh hello erik
<erikh>
Banistergalaxy: hi hi
<andrewvos>
erikh: Except flip flops
<erikh>
andrewvos: haha ok
<andrewvos>
:)
<erikh>
I mean you only have to see so many painfully slow abuses of #inject before you start going "why the fuck doesn't this guy know how to use #each"
<andrewvos>
erikh: Yeah :( It's like salt. Use it sparingly and you have a wonderful meal. Too much of it though, and you die a painful salt death. I think.
<erikh>
heh
<erikh>
yes
<erikh>
painful death by functional programming in a non-tail-call language
<andrewvos>
Starting to think I haven't had much sleep
<erikh>
welcome to my week
<Banistergalaxy>
Hello andrewvos
<erikh>
we have guests this week. I love having them over but it tends to keep me on my toes.
<andrewvos>
Banistergalaxy: Hey :)
<andrewvos>
erikh: :(
<erikh>
that and the additional booze quotient is making me crash a lot earlier, ergo up at 2am ready to work
<erikh>
oh it's not bad, just not sleeping very much is all.
<Banistergalaxy>
Andrewvos are you a scrapper
<andrewvos>
Banistergalaxy: A fighter?
<erikh>
Banistergalaxy: what was that LALR you sent me earlier? you sent it to me as I was packing up for the day
<Banistergalaxy>
Yeah.
<andrewvos>
Banistergalaxy: No
<andrewvos>
Banistergalaxy: Why?
<Banistergalaxy>
Andrewvos I'm a scrapper
<andrewvos>
Banistergalaxy: Erm ok
<Banistergalaxy>
Erikh Yeah it looks cool
<erikh>
what was the url?
<bnagy>
is there a slick way to get whatever class is implemented in a given file and assign it to a var?
<yfeldblum>
ruby has tail calls ... they're just not optimized!
<erikh>
very successful given the number of retweets
<erikh>
zedUNDginger: that's pretty freakin' neat
<erikh>
great docs too
<shevy>
and no eval!
tijmencc joined #ruby-lang
<bnagy>
hrm
<bnagy>
so so basically I have a thing which reads a YAML config file
<bnagy>
and one of the things I need to be able to specify is a class or a module or something which is stored in a file
<bnagy>
like it's a user specified hook class thing that does stuff
takaokouji joined #ruby-lang
<bnagy>
I can have the user store the code as, say, YAML and then load it, but that seems weird
srbartlett joined #ruby-lang
takaokou_ joined #ruby-lang
tijmencc_ joined #ruby-lang
<bnagy>
I can mandate the class name, then have the file it's in in the config
<bnagy>
but that's a bit ugly
tijmencc joined #ruby-lang
srbartlett joined #ruby-lang
tijmencc joined #ruby-lang
y3llow joined #ruby-lang
retro|cz joined #ruby-lang
cynosure joined #ruby-lang
Manhose joined #ruby-lang
burgestrand joined #ruby-lang
looopy joined #ruby-lang
burgestrand joined #ruby-lang
tijmencc_ joined #ruby-lang
tijmencc_ joined #ruby-lang
tijmencc_ joined #ruby-lang
tijmencc joined #ruby-lang
tijmencc_ joined #ruby-lang
tijmencc joined #ruby-lang
tijmencc joined #ruby-lang
toretore joined #ruby-lang
vereteran joined #ruby-lang
<manveru>
YAML is the XML of ruby...
<Tasser>
manveru, it's at least less nosy
statim joined #ruby-lang
<shevy>
XML carries so much </closing_tag> information overhead
<statim>
just curious if anyone knows anything about this. im now on 1.9.3p0 and it takes about 15 seconds to load my rails environment. lots of old talk about this with 1.9.2 and require's, but supposedly the fix was in 1.9.3. so now im not sure what could be going on. anyone heard anything that might help me find a solution?
<rane_>
is it faster than on 1.9.2?
JohnBat26 joined #ruby-lang
<statim>
rane_: not really, times range between 14-16s for each.. maybe this is lower more consistently, but they feel the same
dinesh_ joined #ruby-lang
RomD`` joined #ruby-lang
roadkith joined #ruby-lang
<manveru>
that means you're not using 1.9.3
tijmencc joined #ruby-lang
workmad3 joined #ruby-lang
<yfeldblum>
the 1.9.3 patch to require made it a little more efficient, but did not give $: a fast #include?
tijmencc_ joined #ruby-lang
Pip joined #ruby-lang
mytrile joined #ruby-lang
yorickpeterse1 joined #ruby-lang
tijmencc joined #ruby-lang
tijmencc_ joined #ruby-lang
roadkith joined #ruby-lang
roadkith joined #ruby-lang
roadkith_ joined #ruby-lang
roadkith joined #ruby-lang
Guedes joined #ruby-lang
<muzone>
manveru: u there man?
Pip joined #ruby-lang
Pip joined #ruby-lang
<troubleman>
he's ignoring you muzone
<muzone>
nah can't be man, this guy's always been nice to me
wyhaines joined #ruby-lang
<erikh>
I don't think manveru has a mean bone in his body
<erikh>
he's probably just busy.
workmad3 joined #ruby-lang
tijmencc joined #ruby-lang
mark_locklear joined #ruby-lang
shevy joined #ruby-lang
burgestrand joined #ruby-lang
tommyvyo_ joined #ruby-lang
looopy joined #ruby-lang
<deryl>
manveru is more of a christmas bear. i don;t think the guy *knows* how to be mean
malev joined #ruby-lang
<manveru>
heh
<shevy>
fat like one
<manveru>
muzone: yeah, sorry, we're moving
<shevy>
and he is always moving!!!
j`ey joined #ruby-lang
<yorickpeterse>
He must be on the run
<shevy>
every 2 months
<j`ey>
seems like there is an index method, on Arrays, to return the index of a particular item
<j`ey>
how do I actually return the item
<j`ey>
im sure there used to be Array#find?
<manveru>
used to be?
<yorickpeterse>
By index?
<j`ey>
using a block
<yorickpeterse>
Eh. Array#select
<manveru>
>> [5,6,7].find{|e| e > 6 }
<manveru>
=> 7
<yorickpeterse>
That might be it, otherwise Array#map
<muzone>
no, you? heard good things about it though. pretty much an ableton kid myself..
robbrit left #ruby-lang
<muzone>
ever since i saw jazzy jeff from fresh prince talk about how cool it was (http://www.ableton.com/pages/artists/dj_jazzyjeff) and seeing all my favorite producers abandoning reason over it, i had to check it out
<muzone>
since then it's been an amazing journey
<deryl>
friend gave me his copy of ableton because he's going to Reason. (why, idk) - I'd like to learn Ableton
<muzone>
go for it bro :)
<muzone>
when he hears the shit you're able to cook up with it, he's gonna want that copy back in notime
<muzone>
make sure you get the live library too though, that's where all the secrets are imho
<deryl>
nice
Pip joined #ruby-lang
<jbwiv_>
guys, I'm trying to track down in a rails app where an object is persisted to the database....it's wrapped deeply in libraries. I was thinking about using set_trace_func and passing a method which would match on method name save, or something similar. have any better ideas?
<oddmunds>
muzone: i'm not really learning Rails because of any site idea. i'm just curious.
Tref joined #ruby-lang
tijmencc joined #ruby-lang
fvollero joined #ruby-lang
segy joined #ruby-lang
Jade joined #ruby-lang
tijmencc_ joined #ruby-lang
dv310p3r joined #ruby-lang
Pip joined #ruby-lang
Pip joined #ruby-lang
Tref joined #ruby-lang
Sailias joined #ruby-lang
gnufied joined #ruby-lang
dv310p3r joined #ruby-lang
yorickpeterse1 joined #ruby-lang
dave_miles joined #ruby-lang
pcwormald1 joined #ruby-lang
cyri_ joined #ruby-lang
solars joined #ruby-lang
setmeaway joined #ruby-lang
comboy joined #ruby-lang
znz_v joined #ruby-lang
dkannan joined #ruby-lang
locks joined #ruby-lang
corecode joined #ruby-lang
ohsix joined #ruby-lang
mitchty joined #ruby-lang
imajes joined #ruby-lang
kmeehl joined #ruby-lang
gnufied joined #ruby-lang
rippa joined #ruby-lang
<darix>
jbwiv_: how about just overwriting the save method?
<darix>
alias the old one away. put yours in place and call old aliased method
jwill joined #ruby-lang
slyphon joined #ruby-lang
leonL joined #ruby-lang
pcwormald joined #ruby-lang
nofxx joined #ruby-lang
<jbwiv_>
darix, I've tried that....somehow it still gets persisted. in fact, overwriting save used to work in rails 2.x, but in rails 3.1 something has changed
fayimora joined #ruby-lang
<jbwiv_>
I even believe it worked in rails 3.0
<jbwiv_>
the save gets triggered by an assignment on an association. I essentially want to clone an object, assign an existing object to its association, but prevent any save. the object is purely used for simulation and not necessary to save in this case
outoftime joined #ruby-lang
achamian joined #ruby-lang
MistyM joined #ruby-lang
tris joined #ruby-lang
bruegel joined #ruby-lang
<Sailias>
jbwiv_: i haven't seen the entire discussion, but it looks like you actually want to use the clone method
<Sailias>
not sure if that has been suggested
<jbwiv_>
Sailias, yes, I'm aware of that method. problem is saves still get triggered in activerecord. I want to clone the objects, use existing code which is contained within, but prevent all saves to the database
<Sailias>
jbwiv_: it must be something you are doing. There is no reason why rails 3.1 would cause @parent.children.build to save
<Sailias>
jbwiv_: or are you saying you want to clone an object (which works) but then make the object "unsavable" ?
io_syl joined #ruby-lang
io_syl joined #ruby-lang
retro|cz joined #ruby-lang
<jbwiv_>
Sailias, A has_one B. if I clone an object of A, and then call obj.b = B.new, after_update callbacks get triggered in B, which leads me to believe both objects are getting persisted
<jbwiv_>
Sailias, yes, making it unsavable would likely do the trick
<Sailias>
jbwiv_: it is the has_one that is messing with you
<jbwiv_>
Sailias, yes. I even tried has_one :b, :autosave=>false, but no love
<Sailias>
jbwiv_: i believe that saying obj.b = B.new is doing the assignment. You need to use obj.build_b()
<Sailias>
the brackets are for the attributes of course, i'm not writing java
<jbwiv_>
Sailias, well, sorry, my example is misleading. I really need to do obj.b = B.find(params)
<jbwiv_>
so b will already exist in the db
outoftime joined #ruby-lang
<jbwiv_>
but I wish to assign it to the clone
<jbwiv_>
obj looks at the fields of b to determine certain logic decisions while running the simulation
<Sailias>
jbwiv_: so then obj.build_b(B.find(id).attributes)
<jbwiv_>
but uses it for nothing more than that
<jbwiv_>
Sailias, ah...k. let me try that
macmartine joined #ruby-lang
<jbwiv_>
Sailias, still somehow triggering a save. when I try the above, I get "ActiveRecord::RecordNotSaved: Failed to remove the existing associated vessel. The record failed to save when after its foreign key was set to nil."
<Sailias>
jbwiv: are you able to gist some code?
<Sailias>
jbwiv_: ^
<jbwiv_>
Sailias, let me think how I can. it's pretty involved code...the models are heavy
<Sailias>
jbwiv_: i'll survive
<jbwiv_>
Sailias, give me a min
<Sailias>
jbwiv_: k
<jbwiv_>
Sailias, pm'd you the gist
heftig joined #ruby-lang
<jbwiv_>
Sailias, search for clone in that gist
<jbwiv_>
c.build_vessel triggers the save in the current iteration
<jbwiv_>
tried changing it to c.build_vessel(vessel.clone.attributes) but no luck there either
flip_digits joined #ruby-lang
<Sailias>
ok, give me 2 mins to look it over
<jbwiv_>
Sailias, sure thing...thanks
tbuehlmann joined #ruby-lang
<Sailias>
jbwiv_: i'll continue this in PM
rayners joined #ruby-lang
malev joined #ruby-lang
jondot joined #ruby-lang
<jondot>
anyone happen to work with SQS and some kind of workers in ruby? kinda like resque with SQS backend?
<slyphon>
nothing, i was kicking myself for not just guessing that
srbaker joined #ruby-lang
nuclearsandwich joined #ruby-lang
<rue>
Still have to sell the idea
<rue>
erikh: slyphon's going to javafy Rubygems, OK?
<slyphon>
i was simply trying to +1 headius' idea
<slyphon>
(and not in the google+ way, because i actually wanted someone to see it)
<rue>
Nope, sorry, you're the man now
vereteran joined #ruby-lang
akahn joined #ruby-lang
timbleck joined #ruby-lang
simon_weber joined #ruby-lang
<Spooner>
Anyone able to shed any light on why webrick is breaking for me? https://gist.github.com/1405413 (I'm on a VM and I am a Linux-noob, so I can accept that it is probably something I've set up wrong).
<erikh>
rue: eh, I don't work on it much anymore
<erikh>
I'm kind of pro-headius-maven-gems
dkannan joined #ruby-lang
RickHull joined #ruby-lang
Manhose joined #ruby-lang
locks joined #ruby-lang
beawesomeinstead joined #ruby-lang
cesario joined #ruby-lang
mccraig_ joined #ruby-lang
Jake232 joined #ruby-lang
robbrit joined #ruby-lang
abuiles joined #ruby-lang
dnyy joined #ruby-lang
gnufied joined #ruby-lang
cldwalker joined #ruby-lang
whoops joined #ruby-lang
mrchrisadams joined #ruby-lang
Pip joined #ruby-lang
<andrewvos>
:(
<andrewvos>
So I'm getting some encoding issue trying to PUT data with restclient to sinatra.. Would a good approach be to force_encoding?
comboy joined #ruby-lang
corecode joined #ruby-lang
zetesha joined #ruby-lang
bryanl joined #ruby-lang
looopy joined #ruby-lang
apeiros_ joined #ruby-lang
zetesha joined #ruby-lang
scampbell joined #ruby-lang
plusk joined #ruby-lang
<darix>
andrewvos: what mime type does the client set for the put?
yorickpeterse1 joined #ruby-lang
<andrewvos>
darix: Very good point. I'm not setting one.
RomD`` joined #ruby-lang
kitallis joined #ruby-lang
<andrewvos>
darix: Thanks :)
Wardrop joined #ruby-lang
burgestrand joined #ruby-lang
butchanton joined #ruby-lang
perryh joined #ruby-lang
perryh joined #ruby-lang
FrostyAcres joined #ruby-lang
plusk joined #ruby-lang
RickHull joined #ruby-lang
<darix>
welcome
zetesha joined #ruby-lang
<devn>
What's the idiomatic way to "refer" a specific method from another module without referring all of them?
<devn>
For instance, a method is somewhere else, jumbled up with a whole bunch of other methods. I want one specific method from that module.
<apeiros_>
you mean you want something like include, but only for that single method?
<devn>
apeiros_: exactly.
<apeiros_>
nocando afaik
workmad3 joined #ruby-lang
<devn>
Not even with some crazy magic metaprogramming? ;)
<apeiros_>
I'm not aware of any. you might be able to do it with some crazy bit of C programming.
<devn>
apeiros_: what about adding some structure around the method in question? I suppose that still doesn't negate the need for some specific include.
<devn>
apeiros_: yeah, we're not going there, not today anyway. :)
<apeiros_>
you can put the method in question into its own module and include only that
<apeiros_>
Spooner: that'd require it to be a class method, no?
<apeiros_>
(on OtherModule)
Swimmin__ joined #ruby-lang
<Swimmin__>
if i subclass array, how can i make it so collect/select/etc return an object of the subclass instead of Array
<Spooner>
Yes, and then place it as an instance method on ThisModule, so yeah, pointless (but you could put it on ThisModule's metaclass, I guess). Yeah, won't work will, it?
<steveklabnik>
don't subclass array.
<steveklabnik>
delegate
<steveklabnik>
subclassing core objects leads to subtle bugs
<devn>
and trace amounts of awesome when used with care
<devn>
;)
<Swimmin__>
well delegating for sure it won't return an object of the same class
<apeiros_>
subclass array? did I miss something…
<steveklabnik>
it's your funeral.
<steveklabnik>
Swimmin__: why not? it certainly could.
<devn>
steveklabnik: why the doom and gloom?
<apeiros_>
ah, other question
* apeiros_
goes with steveklabnik - don't subclass
<Swimmin__>
i'd have to manually override every/most enumerable method
<steveklabnik>
devn: because seriously, MRI cheats in the C
<steveklabnik>
Swimmin__: no, you just implement each and mix in Enumerable
<Swimmin__>
hrm
<devn>
steveklabnik: I...did not know that. What would you qualify as cheating?
<Swimmin__>
ok
<steveklabnik>
devn: for example, if you subclass String, and rely on behvior in initialize, sometimes, when MRI creates a string, it does not call String#initialize
<steveklabnik>
sooo you're fucked.
<steveklabnik>
this is For Performance.
<Swimmin__>
so DelegateClass(Array) and implement each such that it returns my same class, then mixing in enumerable willd o the rest
<devn>
steveklabnik: Can we get some double quotes and a (tm) at the end of "For Performance"(tm)
<steveklabnik>
i prefer to just write out the single method missing, but sure.
<manveru>
doesn't make a whole lot of sense for most
<Swimming_Bird>
rue: even when i have each return an object of the new class, collect/select/etc still return an array
<apeiros_>
Swimming_Bird: of course, why would Enumerable care about what your each returns?
<apeiros_>
Enumerable works off of each yielding stuff
<apeiros_>
it can't possibly use the return value
elux joined #ruby-lang
<Swimming_Bird>
yah, i wouldn't think so, but how is it possible to make enumerable return an object of class self instead of array. i haven't been able to figure one out yet
<apeiros_>
it isn't
<manveru>
because it's not possible
<apeiros_>
you have to wrap the method
<manveru>
or reimplement it
<apeiros_>
def select(&block); cast_to_your_class(super); end
<apeiros_>
-&block
towski joined #ruby-lang
achamian joined #ruby-lang
robotmay joined #ruby-lang
dv310p3r joined #ruby-lang
malev joined #ruby-lang
Carnage\ joined #ruby-lang
mark_locklear joined #ruby-lang
michael_mbp_ joined #ruby-lang
kitallis joined #ruby-lang
michael_mbp_ joined #ruby-lang
scampbell joined #ruby-lang
ecin joined #ruby-lang
ilyam_ joined #ruby-lang
mrsolo joined #ruby-lang
saLOUt joined #ruby-lang
michael_mbp_ joined #ruby-lang
jmontross joined #ruby-lang
robbyoconnor joined #ruby-lang
workmad3 joined #ruby-lang
rayners joined #ruby-lang
michael_mbp joined #ruby-lang
phlipper joined #ruby-lang
Pip joined #ruby-lang
michael_mbp_ joined #ruby-lang
mytrile joined #ruby-lang
Pip joined #ruby-lang
saLOUt joined #ruby-lang
[zaf]-Coral joined #ruby-lang
Pip joined #ruby-lang
Pip joined #ruby-lang
Manhose joined #ruby-lang
nuclearsandwich joined #ruby-lang
Banistergalaxy joined #ruby-lang
solars joined #ruby-lang
porcelina joined #ruby-lang
ilyam joined #ruby-lang
scampbell joined #ruby-lang
ilyam joined #ruby-lang
leonL joined #ruby-lang
ivorybishop joined #ruby-lang
<Swimming_Bird>
anyone know of any libraries to puts a grid?
<Swimming_Bird>
err table
zmack joined #ruby-lang
<rue>
HTML!
nlindstrom joined #ruby-lang
<Swimming_Bird>
well it's for a cli util
musl joined #ruby-lang
srbartlett joined #ruby-lang
jwill joined #ruby-lang
<rue>
You can use curl
curtism joined #ruby-lang
solars joined #ruby-lang
srbaker joined #ruby-lang
<Swimming_Bird>
lol
nlindstrom joined #ruby-lang
cesario joined #ruby-lang
nlindstrom joined #ruby-lang
kitallis joined #ruby-lang
DRCALKIN joined #ruby-lang
<rue>
What?
<rue>
Actually I'm pretty sure a gem for such was just mentioned
<heftig>
Swimming_Bird: should be relatively easy, actually
<rue>
Just ~ recently
<Swimming_Bird>
yah, i'm sure it is. thats why i figured there was a good gem for it already
simon_weber joined #ruby-lang
<Swimming_Bird>
rupert is so huge though. does html/pdf/images/graphs
<Mon_Ouie>
That does look like it's just calling puts
<rue>
onio: So it's Kernel#puts, which is included into Object, which is why you can call it from the top-level object (and any other object which hasn't overridden it)
<rue>
My reading's just atrocious of late.
<drbrain>
Mon_Ouie: it will call puts if available, but $stdout only needs to respond to #write
<Banistertab>
But your heart is still in the right pace
<slyphon>
drbrain: oh
<slyphon>
drbrain: i wanted to call your attention to something
<onio>
is there a good documentation on how objects are organized in ruby ?
<slyphon>
drbrain: well, for pure java gems, you could have a dependncy on maven
<slyphon>
so like
<slyphon>
for my zookeeper gem
<drbrain>
slyphon: I think headius just wanted to have a sep that wasn't on rubygems.org?
<slyphon>
i have to create a zookeeper_jar and a log4j_jar gem
<drbrain>
sep => dep
<slyphon>
it's different from that
<slyphon>
which means that i take the official jar and create a slyphon-zookeeper-jar gem
<slyphon>
i'm not authoritative, so anyone else is probably going to do the saem thing for *their* project
boodle joined #ruby-lang
<slyphon>
rather than that jruby would recognize the 'mvn:' string and take care of pulling it from the official maven repositories
<drbrain>
yeah
<slyphon>
i think that's a Good Thing
<rue>
So JRuby handles the special dependency, and gems only needs to allow such a string as a dep?
gearaholic joined #ruby-lang
zmack joined #ruby-lang
<slyphon>
right
<drbrain>
I think that's fine
<slyphon>
ok, cool i think the issue is that rubygems.org won't parse that dep properly
io_syl joined #ruby-lang
io_syl joined #ruby-lang
<drbrain>
yeah
<slyphon>
so, if i/headius were to send you a pull req. with that fix, that'd be cool?
<drbrain>
and there's already some support in rubygems for allowing fetch from blah
<drbrain>
slyphon: I think so
* slyphon
nods
<slyphon>
cool, ok, that's great
gearaholic joined #ruby-lang
Terri joined #ruby-lang
<drbrain>
slyphon: in the pull request message point out that rubygems already has some support for fetching from wherever
* slyphon
nods
postmodern joined #ruby-lang
ilyam joined #ruby-lang
<Terri>
Hello, all. I'm trying to embed Ruby in a C++ project under MSVC2008. I'm using a locally compiled Ruby 1.9.3. I saw the the embedding docs were woefully out of date and found some code laying around the web that I think may fix that problem, but I'm also having trouble with compiling using the static link library (the linker spits out about 100 lines of hate). I compiled Ruby using...
<Terri>
...MSVC 'nmake', does anyone here have some experience working with this that I could bug for a moment?
a3li joined #ruby-lang
io_syl joined #ruby-lang
io_syl joined #ruby-lang
gix joined #ruby-lang
<drbrain>
Terri: few people do that, you'll probably have some success if you send an email to the ruby-talk mailing list
<drbrain>
Terri: especially if it's embedded ruby + MSVC
<Terri>
Yes, I'm starting to get that impression, XD
<drbrain>
Terri: feel free to stick around though, you may get lucky
<Terri>
I'm only using vc because it's a directx app
<Terri>
but I'm looking at ruby-forum.com now
<Terri>
thank you :)
solars joined #ruby-lang
<drbrain>
it mirrors the ruby-talk mailing list
<Terri>
yup
<Terri>
can i post from here?
<Terri>
i mean from ruby-forum.com
<Terri>
or do i have to post on the list
<drbrain>
if you post to ruby-forum it will show up on the list
<drbrain>
and posts to the list show up on the forum
<Terri>
cool. ty
<Terri>
well, I'm gonna try to fiddle with it a bit more and if this new code doesn't help then I'll try posting on the mailing list. Thanks again drbrain.
<drbrain>
Terri: you could paste your output to gist or paste or wherever and link it here, maybe there's an obvious (to us) thing we can help you with
ezkl joined #ruby-lang
deryl joined #ruby-lang
workmad3 joined #ruby-lang
derpcode joined #ruby-lang
<derpcode>
can anyone explain to me why (1..10)eql?(1...11) returns false?
<Mon_Ouie>
Because 1..10 and 1...11 aren't the same thing
<derpcode>
isnt the range 1-10 and 1-10?
<Mon_Ouie>
No, it's [1;10] and [1; 11[
<Mon_Ouie>
10.5 is part of the second range
<Mon_Ouie>
Not of the first
<derpcode>
is 10.1 included to?
<Mon_Ouie>
Anything between 1 and 11 except 11
<derpcode>
right
<derpcode>
thanks Mon_Ouie
<jbwiv_>
is there any way to inspect a block's contained logic? i doubt there is, but didn't know if there were any development niceties which would allow it
onio joined #ruby-lang
<Mon_Ouie>
You can get the bytecode in a human-readable form
<Mon_Ouie>
(well, readable for some humans, at least)
<Mon_Ouie>
puts RubyVM::InstructionSequence.disasm proc {|x| x + 3}
<rue>
rbx's support is (naturally) better
jensn_ joined #ruby-lang
plusk joined #ruby-lang
<rue>
E.g. $ bin/rbx compile -A -S -B -e 'proc {|a| a + 1}' # AST, Sexp and Bytecode
<Banistertab>
mon_ouie can you write a translator from bytecode back to ruby
zedUNDginger joined #ruby-lang
<jbwiv_>
interesting. ok, thanks gusy
<jbwiv_>
guys
<jbwiv_>
one other question. Can someone explain what the & is doing in this line "instance_eval &RailsAdmin::Config.authenticate_with"? I'm unfamiliar with the use of & in that way in ruby
<rue>
jbwiv_: In a method *call*, it invokes #to_proc on its “argument”
<jbwiv_>
rue, ok, so it's essentially the same as col.each {&:size}
<rue>
col.each &:size yes
<jbwiv_>
woops. yes. ok, so why is the : necessary in the second example?
<rue>
:size is a Symbol
<rue>
So, what's that mean?
<jbwiv_>
ah, i see. ok.
<jbwiv_>
i have hazy memories of how that all works. I'll go consult the great oracle Google for details. thanks
<jbwiv_>
it's interesting though. RailsAdmin::Config.authenticate_with is already a proc. why would one want to call to_proc on it? perhaps there are cases where it won't be a proc
<rue>
It's just calling Symbol#to_proc, and then making a block out of that
<rue>
Proc#to_proc just returns self :)
looopy joined #ruby-lang
<rue>
So if moo = lambda { 1 + 1 } then foo &moo == foo { 1 + 1 }
<jbwiv_>
rue gotcha
<jbwiv_>
it's interesting though....if you remove the &, even though it's a proc
<jbwiv_>
you get TypeError: can't convert Proc into String
<jbwiv_>
whereas instance_eval &RailsAdmin::Config.authenticate_with works
<rue>
Right, because without & expanding it, it's the same as instance_eval(Railsblahblah)
<jbwiv_>
rue: ok, I follow you
<jbwiv_>
so if you don't use &, it's put in the main param to instance_eval which expects a string. but if you use &, because it's a proc, it's put into the block variable the method accepts
<rue>
If you don't use &, it's just a parameter
<jbwiv_>
it's still odd to me, though, that & is required. it's already a proc...shouldn't the runtime be smart enough to realize it's a proc and place it in the appropriate param?
<rue>
You may not want to do that
<rue>
As in, it could be that you don't want that behaviour
<rue>
Maybe you do want to pass it in as a param
<rue>
Plus it's a visual cue that it is indeed a block
<jbwiv_>
rue: I see. gotcha
<jbwiv_>
thanks
gd__ joined #ruby-lang
<gd__>
hi all
<gd__>
hope someone can help me: how can i break a .reduce iteration with a return value?
headius joined #ruby-lang
<gd__>
so i can write the following: ret_val = foo.reduce(false).reduce { |a,b| ...some..code..; break if a == true }
<steveklabnik>
and it's basically just _send_, look at the source. ;)
hagabaka joined #ruby-lang
<rue>
gd__: But then you probably shouldn't be using #reduce (or #inject as you should probably call it)
ivanoats joined #ruby-lang
<steveklabnik>
yeah
brianpWins joined #ruby-lang
<steveklabnik>
unless it was being lazily evaluated
<steveklabnik>
then you might be okay.
zedUNDginger joined #ruby-lang
<gd__>
rue: nn sideeffects
<gd__>
so i stay with reduce, or you teach me better by example :)
<gd__>
and i want to call it reduce, not inject as inject is missleading
<gd__>
reduce_left ftw
<steveklabnik>
heh
<rue>
Well, I'll wager 85% of Ruby programmers will have to check the documentation to figure out what you're trying to do
onio joined #ruby-lang
<rue>
For better or worse, it's #inject
<steveklabnik>
you either go with haskell, or smalltalk.
<steveklabnik>
collect/inject or map/reduce
<steveklabnik>
most rubyists pick smalltalk
<rue>
gd__: Without an actual use case I can't say if there's a better option, but breaking early out of a reduce, as you say, is smelly
<rue>
Which is to say it might be necessary, but warrants consideration
<gd__>
blabla :)
<onio>
I'm a noob, is this correct :
<onio>
class Bear
<onio>
@@bears = {
<onio>
"winnie" => Bear.new("Winnie"),
<onio>
"balou" => Bear.new("Balou")
<onio>
}
<onio>
end
<onio>
??
<gd__>
pastebin!
<rue>
onio: 1. Use gist or pastie (/topic) and 2. sure, that works if that's what you want to do
perryh_ joined #ruby-lang
<onio>
sorry
<rue>
You could use a constant, perhaps, or a method, a class ivar instead of a class var…
jensn joined #ruby-lang
<onio>
ok but is it correct to put some objects references as second members of hashes ?
<rue>
Yes, for a Hash you can use any object as a key and as a value
<rue>
(For keys, the object needs to respond to #hash and #eql?)
<onio>
ok it means I have to write a hash method to calc the key , right ?
<rue>
onio: ri Object#hash :)
boodle joined #ruby-lang
slyphon joined #ruby-lang
RickHull left #ruby-lang
Banistertab` joined #ruby-lang
slyphon_ joined #ruby-lang
<onio>
ok for ri
Rakko joined #ruby-lang
<onio>
I'm sorry I really don't know anything to irc, I guess pastebin, gist or pastie are tools to paste source code, is that correct ?
<steveklabnik>
yes
<injekt>
:)
<injekt>
gist or pastie
<injekt>
pastebin makes me gag
looopy joined #ruby-lang
<Rakko>
hi
mksm joined #ruby-lang
<onio>
to use a static method, i write it "def self.method(arg)", then I call Class.method right ?
<steveklabnik>
ruby doesnt have static methods
<steveklabnik>
it does have class methods though
<steveklabnik>
which is what that is
<steveklabnik>
and that is how you call them.
<steveklabnik>
and it wouldnt be Class.method
<steveklabnik>
it'd be YourClass.method
<steveklabnik>
and you could also define it as def YourClass.method(arg)
<steveklabnik>
... though that's kinda stupid.
tomzx joined #ruby-lang
<steveklabnik>
(because Class is already a class ;) )
<onio>
ok I read that you're right my example is stupid
<steveklabnik>
it's not, i was just picking knits. sorry.
<steveklabnik>
it's funny, because 'method' is actually a method on Object, not Class...
<steveklabnik>
heh.
<steveklabnik>
whateves, i'm rambling. you have the correct idea.
<onio>
I come from c++, it's hard to switch between ruby which is a very evolved programming language, and c++ which is powerful at runtime but hard to write
<steveklabnik>
but they are class methods not static methods
<steveklabnik>
absolutely.
<onio>
ok
<steveklabnik>
C++ damages your brain. ;)
zedUNDginger joined #ruby-lang
<onio>
you're right but assembly is worse
<Asher>
or php
<steveklabnik>
naw, that teaches you stuff.
porcelina joined #ruby-lang
Guest2452 joined #ruby-lang
<onio>
when I am on a method definition is self the reference of the current object or the reference of the current class ?