jsullivandigs has quit [Remote host closed the connection]
tylersmith has quit [Remote host closed the connection]
knu has quit [Ping timeout: 252 seconds]
knu has joined #ruby-lang
apeiros has joined #ruby-lang
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
Fyyr13 has quit [Remote host closed the connection]
robbyoconnor has quit [Ping timeout: 252 seconds]
Voker57 has quit [Read error: Connection reset by peer]
knu has quit [Ping timeout: 252 seconds]
knu has joined #ruby-lang
CJD14 has joined #ruby-lang
simoz19 has joined #ruby-lang
mbj has joined #ruby-lang
simoz110 has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
kurko_ has quit [Quit: Computer has gone to sleep.]
havenwood has joined #ruby-lang
robbyoconnor has joined #ruby-lang
robbyoconnor has quit [Read error: Connection reset by peer]
clamstar has quit [Quit: Computer has gone to sleep.]
simoz19 has quit [Ping timeout: 264 seconds]
simoz110 has quit [Ping timeout: 264 seconds]
havenwood has quit [Ping timeout: 252 seconds]
centrx has quit [Quit: Leaving]
kitak has quit [Remote host closed the connection]
kitak has joined #ruby-lang
phansch has joined #ruby-lang
phansch_ has quit [Ping timeout: 260 seconds]
simoz110 has joined #ruby-lang
mbj has quit [Quit: Lost terminal]
face has joined #ruby-lang
symm- has quit [Ping timeout: 245 seconds]
knu has quit [Ping timeout: 252 seconds]
knu has joined #ruby-lang
moneydouble has quit [Quit: Leaving.]
vpretzel has joined #ruby-lang
kitak has quit [Remote host closed the connection]
iliketur_ has joined #ruby-lang
iliketur_ has quit [Excess Flood]
judofyr has joined #ruby-lang
iliketurtles has quit [Ping timeout: 248 seconds]
iliketur_ has joined #ruby-lang
charliesome has joined #ruby-lang
vpretzel has quit [Ping timeout: 272 seconds]
Elico has quit [Ping timeout: 272 seconds]
havenwood has joined #ruby-lang
havenwood has quit [Read error: Connection reset by peer]
havenwood has joined #ruby-lang
judofyr has quit [Remote host closed the connection]
levifig has quit [Read error: Operation timed out]
Elico1 has joined #ruby-lang
levifig has joined #ruby-lang
kitak has joined #ruby-lang
doki_pen_ has quit [Read error: Operation timed out]
knu has quit [Ping timeout: 252 seconds]
knu has joined #ruby-lang
hackeron_ has quit [Read error: Operation timed out]
havenwood has quit [Read error: Connection reset by peer]
hackeron has joined #ruby-lang
gix has quit [Read error: Operation timed out]
llakey has quit [Read error: Operation timed out]
havenwood has joined #ruby-lang
certainty has quit [Read error: Operation timed out]
hagebake has quit [Read error: Operation timed out]
kylo has quit [Ping timeout: 265 seconds]
certainty has joined #ruby-lang
ahf has quit [Read error: Operation timed out]
ahf has joined #ruby-lang
ahf has joined #ruby-lang
ahf has quit [Changing host]
doki_pen has joined #ruby-lang
joonty has quit [Ping timeout: 265 seconds]
amcoder has quit [Quit: ZZZzzz…]
hagabaka has joined #ruby-lang
llakey has joined #ruby-lang
joonty has joined #ruby-lang
kylo has joined #ruby-lang
judofyr has joined #ruby-lang
mistym has quit [Remote host closed the connection]
robbyoconnor has joined #ruby-lang
gix has joined #ruby-lang
Elico1 has quit [Quit: Elico1]
Elico has joined #ruby-lang
havenwood has quit [Ping timeout: 264 seconds]
<ljarvis>
moin
<judofyr>
hi ljarvis
tylersmith has joined #ruby-lang
<ljarvis>
hello judofyr
<judofyr>
what's up ljarvis
<ljarvis>
not much judofyr, just started work, yourself?
<judofyr>
ditto
tsou has quit [Quit: off]
elliotec has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 264 seconds]
elliotec has joined #ruby-lang
knu has quit [Ping timeout: 252 seconds]
<hardy12>
Hey all
knu has joined #ruby-lang
tylersmith has quit [Ping timeout: 252 seconds]
yfeldblu_ has quit [Read error: Connection reset by peer]
tsou has joined #ruby-lang
setmeaway has quit [Ping timeout: 272 seconds]
yfeldblum has joined #ruby-lang
iliketurtles has joined #ruby-lang
<judofyr>
hey hardy12
<judofyr>
nice, Eric Wong got commit access to ruby-core \o/
robbyoconnor has quit [Ping timeout: 264 seconds]
cnivolle has joined #ruby-lang
iliketur_ has quit [Ping timeout: 245 seconds]
clamstar has joined #ruby-lang
cnivolle_ has joined #ruby-lang
arBmind has quit [Quit: Leaving.]
elliotec has quit [Remote host closed the connection]
elliotec has joined #ruby-lang
cnivolle has quit [Ping timeout: 252 seconds]
woollyams has joined #ruby-lang
iliketurtles has quit [Quit: zzzzz…..]
benlovell has joined #ruby-lang
mrgrieves has joined #ruby-lang
elliotec has quit [Ping timeout: 264 seconds]
clamstar has quit [Quit: Computer has gone to sleep.]
rahul_j has joined #ruby-lang
heftig has joined #ruby-lang
<mrgrieves>
hi, how can I apply conditionals in ruby so that when a command fails while using the each method the iteration doesn't break? http://pastebin.com/ggbqXcwf
korpz has joined #ruby-lang
<certainty>
mrgrieves: rescue the exception
<mrgrieves>
certainty:Thanks, how can I do that? What I'm trying to do is to obtain a hash at the end with the directories that were found
robmiller has joined #ruby-lang
<mrgrieves>
if a dir is not found I just want to carry on with the iteration
vpretzel has joined #ruby-lang
<certainty>
mrgrieves: you can either check if the directory exists before you access it (which probably is prone to a race condition) or just handle thaÃe exception. http://www.rubyist.net/~slagell/ruby/rescue.html
<maloik>
Anyone here happen to make heavy use of d3js for stock exchange-like pages ?
<judofyr>
mrgrieves: check if File.exist?("#{appdir}/#{comp}/release")
arBmind has joined #ruby-lang
<certainty>
still possible that it is deleted between the two operations
vpretzel has quit [Ping timeout: 245 seconds]
joonty has quit [Quit: WeeChat 0.4.2]
jsrn has joined #ruby-lang
knu has quit [Ping timeout: 252 seconds]
havenwood has joined #ruby-lang
knu has joined #ruby-lang
michd is now known as MichD
elia has joined #ruby-lang
<mrgrieves>
thanks guys, I'd like to give rescue a try
phansch has quit [Quit: Leaving]
<mrgrieves>
but just trying to assign "NA" to the item if the exception is rescue is giving me syntax errors
francisfish has joined #ruby-lang
francisfish has quit [Remote host closed the connection]
cnivolle_ has quit [Remote host closed the connection]
cnivolle has joined #ruby-lang
joonty has joined #ruby-lang
<certainty>
mrgrieves: just do this: rel[comp] = File.readlink("#{appdir}/#{comp}/release") rescue "NA"
CJD14 has quit [Ping timeout: 272 seconds]
RoxasShadowRS has joined #ruby-lang
<mrgrieves>
brilliant!
<mrgrieves>
what if I just don't want to add that item to the hash at all? any suggestions?
<whitequark>
begin rel[comp] = File.readlink(...) rescue end
atmosx has joined #ruby-lang
<mrgrieves>
thank you very much guys! I definetly need to do some reading on exception handling and ruby in general
<mrgrieves>
thanks again
<yorickpeterse>
morning
<judofyr>
yorickpeterse: how's your Mongo adventure going?
enkristoffer has joined #ruby-lang
benlovell has quit [Quit: leaving]
<yorickpeterse>
I fucking hate it
<yorickpeterse>
also I need a new chair at home, any suggestions?
<yorickpeterse>
I don't mind racking up a few hundred bucks
simoz110 has quit [Ping timeout: 252 seconds]
bin7me has joined #ruby-lang
yuuki has joined #ruby-lang
tbuehlmann has joined #ruby-lang
enkristoffer has quit [Ping timeout: 240 seconds]
yuuki has quit [Client Quit]
havenwood has joined #ruby-lang
havenwood has quit [Read error: Connection reset by peer]
havenn has joined #ruby-lang
_tockitj has joined #ruby-lang
<ledestin>
yorickpeterse: HEIST cow leather is what I have
atmosx has quit [Quit: Lost in trance]
<ledestin>
yorickpeterse: very good
<ledestin>
yorickpeterse: I've tried many before I found a decent one
<yorickpeterse>
Hm, I fear that my cat will enjoy a leather chair too much though
<yorickpeterse>
"Hmmm yes this looks like a nice place to sharpen my claws"
<wnd>
I wouldn't mind having a Swopper chair at home, one at the office has really helped with my back
saarinen has joined #ruby-lang
Pupeno_w has joined #ruby-lang
DouweM has quit [Ping timeout: 240 seconds]
<yorickpeterse>
I have some shitty 80 bucks Ikea chair at home
marr has joined #ruby-lang
<yorickpeterse>
The back is hollow and although that used to be fine the fabric is slowly stretching a bit
<yorickpeterse>
meaning it becomes less comfortable
<yorickpeterse>
At $WORK we have standard office chairs
mehlah has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
havenn has quit [Read error: Connection reset by peer]
havenwood has joined #ruby-lang
<ledestin>
recliner works for me and laptop, but for desktop it's not good
<ledestin>
because I have to move it every time I want in or out
jonahR has quit [Quit: jonahR]
<maloik>
go to a specialized store
<maloik>
there's herman miller lookalikes starting at 350-450 euro
<maloik>
I remember trying a super nice one for 450 or so, almost bought it but then decided to save my money
<maloik>
you just need to train your cat imo :-)
<ledestin>
my chair was $300 NZD
<maloik>
ours is several years old, my mom apparently trained it by keeping a water sprayer nearby
<ledestin>
1 euro is about 2 NZD
<maloik>
so whenever he did something he wasnt supposed to she'd spray the cat
vpretzel has joined #ruby-lang
<yorickpeterse>
maloik: mine is pretty well trained but still an ass
<maloik>
now she just needs to pick it up and show it to the cat, and it'll know what's up
<maloik>
pretty baller
saarinen has quit [Ping timeout: 264 seconds]
<yorickpeterse>
also if I'm going to spend lots of gold on a chair I want the real deal
<yorickpeterse>
not some Chinese knock-off
<maloik>
they're not knockoffs, just less expensive than real herman millers
<maloik>
a real one will set you back 1000 euro if not more
havenwood has quit [Ping timeout: 248 seconds]
saarinen has joined #ruby-lang
workmad3 has joined #ruby-lang
DouweM has joined #ruby-lang
bzalasky has joined #ruby-lang
vpretzel has quit [Ping timeout: 252 seconds]
r0bgleeson has joined #ruby-lang
skade has quit [Quit: Computer has gone to sleep.]
saarinen has quit [Quit: saarinen]
rjrj has joined #ruby-lang
dagobah has joined #ruby-lang
phansch has joined #ruby-lang
diegoviola has joined #ruby-lang
rjrj has quit [Remote host closed the connection]
canderson has joined #ruby-lang
kitak has quit [Remote host closed the connection]
mehlah has quit [Ping timeout: 264 seconds]
skade has joined #ruby-lang
mehlah has joined #ruby-lang
bzalasky has quit [Remote host closed the connection]
TvL2386 has joined #ruby-lang
<TvL2386>
hi guys, I'm building a gem which has a dependency on 'json'. Because I assumed json was in the standard lib, it does not work on ruby-1.8.7 which it should. How can I fix this? Should I just put 'json' as a dependency and will that work fine with >= 1.9.2?
anulman has quit [Quit: Leaving.]
<yorickpeterse>
Save yourself trouble and drop 1.8 support
<yorickpeterse>
JSON is both in stdlib as well as a Gem
<yorickpeterse>
The Gem version typically is newer
<yorickpeterse>
(and in more recent versions it was also faster)
<TvL2386>
thanks yorickpeterse, unfortunately dropping 1.8.7 is not yet an option
<ledestin>
TvL2386: security support for 1.8 was dropped AFAIK
<yorickpeterse>
lol 1.8 support
<yorickpeterse>
fuck that shit
<yorickpeterse>
However, the JSON gem should work fine on 1.8 as well
<yorickpeterse>
There's no harm in simply adding a dep in your Gemspec to it
joonty has quit [Ping timeout: 240 seconds]
joonty has joined #ruby-lang
MichD is now known as michd
yfeldblum has quit [Ping timeout: 260 seconds]
<TvL2386>
thanks!
michd is now known as MichD
<r0bgleeson>
yorickpeterse: that's usually my reaction too. lol fuck that shit.
<yorickpeterse>
yet I still have an REE app in $PROD :<
elliotec has quit [Remote host closed the connection]
dm78 has quit [Remote host closed the connection]
elliotec has joined #ruby-lang
dm78 has joined #ruby-lang
Asher has joined #ruby-lang
hfp has quit [Ping timeout: 252 seconds]
chouhoulis has quit [Ping timeout: 252 seconds]
hfp has joined #ruby-lang
feinberg_ has joined #ruby-lang
cirenyc has quit [Read error: Connection reset by peer]
feinbergscott has quit [Ping timeout: 245 seconds]
dm78 has quit [Ping timeout: 272 seconds]
<|jemc|>
this definitely seems like a weird smell, but does anyone know of a way to assert in a unit test that an object is no longer "reachable" (and is thus free for garbage collection)? Obviously, it would seem the test itself would need to hold a reference to the object to make that assertion, so you would actual be checking that it is reachable from nowhere else...
symm- has quit [Ping timeout: 245 seconds]
<drbrain>
|jemc|: there is not such a way
<drbrain>
|jemc|: ruby's GC is conservative so there is not a way inside ruby to determine this
<drbrain>
the object may be referenced on the stack which ruby can't "see"
<yorickpeterse>
woaaah, new Github PR design
<apeiros>
|jemc|: you could test whether it has been collected
dm78 has joined #ruby-lang
<apeiros>
|jemc|: see WeakRef
<|jemc|>
does ObjectSpace.each_object yield only objects "reachable" through normal means?
<apeiros>
I doubt it
<yorickpeterse>
it yields objects that are currently alive, anywhere
<|jemc|>
okay
<|jemc|>
I'll try the WeakRef route
<apeiros>
I'm not sure whether a manual GC.start ensures collection
<|jemc|>
is GC.start still the preferred way to try to instigate garbage collection?
<|jemc|>
ah
dm78 has quit [Remote host closed the connection]
dm78 has joined #ruby-lang
solars has quit [Quit: WeeChat 0.4.1]
<drbrain>
apeiros: if the object is referenced only on the stack it won't be collected so will still be accessible via WeakRef even after GC.start
deens has joined #ruby-lang
francisfish has quit [Remote host closed the connection]
<apeiros>
:-/
<apeiros>
so indeed no reliable way to tell without patching MRI
<drbrain>
it won't be otherwise accessible (because you don't have a reference to it in a variable)
<|jemc|>
I'm just trying to figure out the best way to add a spec for a "memory leak" bugfix
<apeiros>
GC metrics might help there. not sure about that either, though.
<yorickpeterse>
what are you doing that you want to manually trigger a GC run?
<drbrain>
yes, GC metrics on an integration test which easily leaks
<yorickpeterse>
ah, memory leaks
<yorickpeterse>
I'd say doing that and using ObjectSpace is a bit of a hack
<|jemc|>
well, it's certainly not elegant
<drbrain>
you need to run the leak-generating code enough to be sure that the GC runs
<|jemc|>
I'll try drbrain's approach
<|jemc|>
thanks folks
<drbrain>
and probably a couple times to see if you reach a steady state (no leaks) or have growth (leaks) in object counts
patriciomacadden has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<|jemc|>
yeah
<drbrain>
nowadays you can ask ruby how many times the GC has run and how many objects are allocated, so you should be able to avoid false positives
dm78 has quit [Ping timeout: 245 seconds]
<|jemc|>
yeah, something like 'do_big_thing until gc_has_run_again'
charliesome has joined #ruby-lang
jsullivandigs has quit [Remote host closed the connection]
<drbrain>
↑ yeah
deens has quit [Remote host closed the connection]
specialblend has joined #ruby-lang
blaz3rz has joined #ruby-lang
phansch_ has joined #ruby-lang
moneydouble has left #ruby-lang [#ruby-lang]
marr has joined #ruby-lang
makoto_ has joined #ruby-lang
elliotec has quit [Remote host closed the connection]
skade has quit [Quit: Computer has gone to sleep.]
phansch has quit [Read error: Operation timed out]
kurko_ has quit [Quit: Computer has gone to sleep.]
phansch_ is now known as phansch
r0bglees0n has joined #ruby-lang
havenwood has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
r0bgleeson has quit [Ping timeout: 260 seconds]
smashwilson has quit [Quit: Leaving]
makoto_ has quit [Ping timeout: 252 seconds]
workmad3 has joined #ruby-lang
mrevd has quit [Quit: Leaving.]
ohsix has quit [Quit: butt]
robbyoconnor has joined #ruby-lang
robbyoconnor has quit [Changing host]
robbyoconnor has joined #ruby-lang
jsullivandigs has joined #ruby-lang
phansch_ has joined #ruby-lang
__butch__ has quit [Quit: Leaving.]
ohsix has joined #ruby-lang
ohsix has quit [Client Quit]
ohsix has joined #ruby-lang
yfeldblum has quit [Read error: Connection reset by peer]
phansch has quit [Ping timeout: 272 seconds]
yfeldblum has joined #ruby-lang
breakingthings has quit []
panpainter has quit [Quit: panpainter]
mattsp1290 has quit [Remote host closed the connection]
havenwood has quit []
poor_leno has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jvrmaia has joined #ruby-lang
ssb123 has joined #ruby-lang
vpretzel has quit [Quit: Adios!]
mykoweb has quit [Remote host closed the connection]
Asher has quit [Quit: Leaving.]
mykoweb has joined #ruby-lang
dm78 has joined #ruby-lang
shinnya has joined #ruby-lang
bjh13 has quit [Quit: leaving]
feinberg_ has quit [Ping timeout: 265 seconds]
lfox has quit [Quit: ZZZzzz…]
ender|dktm has quit [Quit: Lost terminal]
chouhoulis has joined #ruby-lang
lcdhoffman has joined #ruby-lang
mykoweb has quit [Remote host closed the connection]
deens has joined #ruby-lang
elliotec has joined #ruby-lang
|jemc| has quit [Quit: WeeChat 0.4.2]
|jemc| has joined #ruby-lang
postmodern has joined #ruby-lang
chouhoulis has quit [Ping timeout: 265 seconds]
airdisa has joined #ruby-lang
Cakey has joined #ruby-lang
mbj has joined #ruby-lang
phansch_ has quit [Quit: Leaving]
jvrmaia has quit []
CaptainJet has joined #ruby-lang
Elico has joined #ruby-lang
gix has quit [Quit: Client exiting]
elia has joined #ruby-lang
airdisa has quit [Client Quit]
GaelanAintAround is now known as Gaelan
jtw has quit []
gix has joined #ruby-lang
dannysmith has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nofxx has joined #ruby-lang
nigerianceo has quit []
deens has quit [Remote host closed the connection]
mykoweb has joined #ruby-lang
kinginky has joined #ruby-lang
<kinginky>
hello. i am trying to use activerecord in some slightly strange circumstances. first of all, my project is NOT rails-based. im trying to use active record to connect to >1 database. i found lots of info on this through google, for instance, supplying establish_connection in my model
mykoweb has quit [Remote host closed the connection]
<kinginky>
anyway, nothing works. i can load everything up, establish the connection through Base, but when i try to call on a model, i get an error saying it could not connect to the MYSQL DB, but it is trying to connect to root@MY-NET-IP (<---- not localhost)
<kinginky>
so i dunno whats going on
<kinginky>
ive tried to set ActiveRecord::Base.configurations
<kinginky>
ive tried including establish_connection in my models... etc.... in other words, im at a loss and hoping IRC can help today
nathanstitt has quit [Quit: I growing sleepy]
<drbrain>
kinginky: if nobody answers here, you may want to try #rubyonrails
<drbrain>
since activerecord is part of rails
<kinginky>
dbrain: not a bad idea.... i noticed there's no activerecord channel, dunno why i didnt think of this
<apeiros>
kinginky: iirc when I used AR outside of rails I also had issues
<kinginky>
on that note.. know of any good ORMs besides AR, DataMapper, and Sequel?
<apeiros>
kinginky: it turned out that it had to do with the hash passed to establish_connection. I don't remember well, I think I assumed it wanted string keys because the database.yml uses string keys, but it wants symbols. or other way round.
<kinginky>
ya this project requires a connection to >1 DB which is preventing me from using my natural Squal
<kinginky>
Sequel
cnivolle has quit [Remote host closed the connection]
<kinginky>
ok, ok thx
<apeiros>
huh? Sequel can connect to multiple db's just fine
<kinginky>
apeiros: that might be it
<drbrain>
kinginky: taps (gem) uses Sequel to connect to multiple DBs
<apeiros>
at least I'm pretty sure I've done so
kith has quit [Read error: Connection reset by peer]
<kinginky>
god
<kinginky>
u guys are so amazing
seanlinsley has quit [Quit: …]
kith has joined #ruby-lang
<kinginky>
i think (ok, yeah, i am) that im a ruby expert
<kinginky>
but when i come here as a last resort
brettweavnet has quit [Quit: Bye]
<kinginky>
jesus
<kinginky>
humbles me
<kinginky>
thx for the great suggestions, looking into all these things now
<kinginky>
ty
<apeiros>
hf
<drbrain>
\ol
<drbrain>
\o/
<kinginky>
i will have fun xD
<kinginky>
its my life man
<kinginky>
more people need to get obsessed w/ computers ;)
<kinginky>
the world would be a better place
makoto_ has joined #ruby-lang
Cakey has quit [Ping timeout: 265 seconds]
<apeiros>
no, no, I think I like it that the local farmers don't obsess with computers… I like my fresh food :)
<kinginky>
haha true.. if the whole world consisted of computer experts, well, we'd have no society ;)
<kinginky>
anyway... this taps... looks like it has a specific purpose. were you suggesting looking into using taps, or looking into taps' source itself (i.e. since it uses sequel w/ >1 DB)?
dm78 has quit [Remote host closed the connection]
DevDoo has quit [Remote host closed the connection]
iliketurtles has quit [Quit: zzzzz…..]
dm78 has joined #ruby-lang
dm78 has quit [Read error: Connection reset by peer]
DevDoo has joined #ruby-lang
bantic has quit [Quit: bantic]
workmad3 has quit [Ping timeout: 260 seconds]
dm78 has joined #ruby-lang
<kinginky>
apeiros: sorry, forgot to include ur name on the last two messages. hoping u could answer that question for me. thanks again
makoto_ has quit [Ping timeout: 240 seconds]
<apeiros>
kinginky: drbrain suggested taps. I haven't used it
<drbrain>
kinginky: I suggested taps as an example of a gem that used multiple databases with sequel
<drbrain>
kinginky: since you didn't explain your purpose beyond "I need >1 DB" I'm not sure if its suitable for more than looking at
<drbrain>
(if you do need to migrate a database to a new machine, it does that quite well!
<kinginky>
apeiros: ty
<kinginky>
drbrain: ty
<kinginky>
drbrain: ill look into the source. if multiple DBs is possible thru Sequel, my life becomes a lot easier
AtnNn has joined #ruby-lang
<drbrain>
:D
guns has joined #ruby-lang
DevDoo has quit [Ping timeout: 272 seconds]
iliketurtles has joined #ruby-lang
iliketurtles has quit [Excess Flood]
dm78 has quit [Ping timeout: 248 seconds]
<AtnNn>
Hello. Is it possible to make a proc with a fixed arity out of a bloc that has a variable number of arguments?
<drbrain>
AtnNn: I think only by wrapping it in a proc
<drbrain>
AtnNn: why do you need this?
robbyoconnor has quit [Ping timeout: 252 seconds]
<kinginky>
AtnNn: sounds kind of strange. maybe there's a simpler way to do what you're looking for
<kinginky>
or maybe im misunderstanding...
<kinginky>
give me an example
patriciomacadden has joined #ruby-lang
<AtnNn>
drbrain: I'm trying to get a method defined by define_method to work with a function that behaves differently depending on the arity of it's argument
<kinginky>
that still doesnt tell me much, personally...
<drbrain>
AtnNn: wrapping it is the way to go, then
<kinginky>
what is the purpose?
dorei has joined #ruby-lang
<drbrain>
AtnNn: making a method behave differently depending on the arity of an argument is rather strange
<kinginky>
drbrain: why?
<AtnNn>
drbrain: the method gets serialised and sent elsewhere for evluation
<kinginky>
lots of popular libraries do this based on opt count or opt presence
<dorei>
is there some way for autocurrying on ruby procs/lambdas ?
<drbrain>
dorei: there is Proc.curry
<dorei>
oh, thanx, i'll take a look at it :)
<kinginky>
drbrain: appreciate ur helpfulness and not trying to be an ass, just trying to learn, but why wouldn't you evaluate a function on arity as opposed to say an opt hash
patriciomacadden has quit [Ping timeout: 260 seconds]
<kinginky>
or were u just saying it's odd, not that it's unacceptable?
<kinginky>
because it is odd, i agree
simoz111 has quit [Ping timeout: 260 seconds]
<drbrain>
kinginky: its generally odd to change behavior based on arity, but that may be something beyond AtnNn's control
<drbrain>
the link seems to indicate it is beyond AtnNn's control
<kinginky>
drbrain: exactly what i was thinking. sounds like he's dealing with more people than himself
<kinginky>
but yes, i see the arity oddness point. i thoguht you were saying he SHOULDN'T do it that way, so i was thinking maybe there was a good reason other than that it is against convention
<kinginky>
thanks
DEac-_ has joined #ruby-lang
DEac- has quit [Read error: Connection reset by peer]
<AtnNn>
I've been thinking about just using eval, but it makes for some ugly code
<kinginky>
AtnNn: avoid eval at all costs unless u arent worried about security
elliotec has quit [Remote host closed the connection]
lcdhoffman has quit [Quit: lcdhoffman]
<drbrain>
AtnNn: if you have: real_proc = proc do |*a| blah(a) end
<kinginky>
not that ive personally had a problem with eval, actually i use it in a few cases (taking regex from DB and "evaling" to regex)
<kinginky>
is there a better way to do this?
<drbrain>
AtnNn: then you can: wrapper = proc do |arg_1, arg_2| real_proc.call(arg_1, arg_2) end