Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
sockmonk has joined #ruby-lang
plusk has quit ["Leaving"]
naz has joined #ruby-lang
twelvechairs has joined #ruby-lang
brownies has joined #ruby-lang
twelvechairs has joined #ruby-lang
dejongge has joined #ruby-lang
jorgenpt has joined #ruby-lang
fayimora has joined #ruby-lang
seanstickle has joined #ruby-lang
andman has joined #ruby-lang
vesan has joined #ruby-lang
srbartlett has joined #ruby-lang
y3llow has joined #ruby-lang
amerine has joined #ruby-lang
heftig has joined #ruby-lang
melter has joined #ruby-lang
Tick-Tock has joined #ruby-lang
retro|cz has joined #ruby-lang
indeterminate has joined #ruby-lang
unsymbol has joined #ruby-lang
pabs has joined #ruby-lang
cyndis has joined #ruby-lang
lele|w has joined #ruby-lang
zenspider has joined #ruby-lang
basicxman has joined #ruby-lang
mrb_bk has joined #ruby-lang
Kero has joined #ruby-lang
joschi has joined #ruby-lang
aef has joined #ruby-lang
mitchty has joined #ruby-lang
y3llow has joined #ruby-lang
looopy has joined #ruby-lang
pabloh has joined #ruby-lang
ascarter_ has joined #ruby-lang
<pabloh> does anyone know if top level instance variables are file scoped?
headius has joined #ruby-lang
volty has joined #ruby-lang
Gunnar has joined #ruby-lang
replore has joined #ruby-lang
<drbrain> pabloh: they are
<drbrain> oh, I thought you said local, instance variables are shared since you're working on the same top-level instance
<injekt> heh
<pabloh> drbrain, ok thx, banisterfiend already told me at #ruby
<andrewvos> oooh burn
<injekt> global methods are throw into Object, yet ivars are not
<injekt> also, cross posting is annoying
<pabloh> injekt: err..., sry
<rue> #ruby is annoying
<injekt> especially somewhere as rude as ruby
<injekt> oh here we go
<injekt> dont start rue
<injekt> every. single. time.
<andrewvos> Now you got rue all pissed off
<injekt> it's like he has a hilight on #ruby
<injekt> so I've been using ST2 for about 2-3 hours now and I actually love it
<twelvechairs> cross posting might be annoying, but it makes sense when there are two channels for the same thing....
<injekt> this channel is official
<injekt> the other is not, let's go and make a third one and post there too shall we?
<injekt> it makes sense because they're all for the same thing
<injekt> :D
<andrewvos> hmm, sounds logical
<twelvechairs> yes. however that channel regularly has nearly twice the number of people on it...
<deryldoucette> but to most people #ruby would be the official in their mind. they don't know about #ruby-lang pere i'd wager
<injekt> deryldoucette: pretty much exactly the only reason they get so many users
<andrewvos> #lolruby
<deryldoucette> injekt: i can't fault that logic
<andrewvos> Why don't we all just go there?
<injekt> yeah, we're closing #ruby-lang
<injekt> just leave rue here
<deryldoucette> just saying, i can see why they would think #ruby rather than #ruby-lang would be the 'official' channel.
<deryldoucette> lol
<deryldoucette> rue turn off the lights before you leave
<andrewvos> hahahaha
<injekt> deryldoucette: I agree
<twelvechairs> Maybe it is sacrelidge to say this here, but why can't they just make #ruby the official channel? Surely the owners of the channels could talk to each other
<injekt> tried that
<injekt> (talking)
<andrewvos> We lost 17 men that day
Karmaon has joined #ruby-lang
<injekt> and a bot
<injekt> RIP
<andrewvos> OOh that remidns me I was setting up a bot for work!!
<deryldoucette> Robots In Pieces?
* zenspider pours a drink for his homies
<injekt> deryldoucette: robots in #python
<injekt> andrewvos: an irc bot?
<twelvechairs> wow. sounds.... apathetic...
<deryldoucette> quick get him! he said the P word!
<injekt> uh oh!
* injekt runs
<andrewvos> injekt: yeah
<injekt> zenspider: thank you for minitest
<zenspider> injekt: my pleasure
<zenspider> thanks for enjoying it
<andrewvos> zenspider: Yah I second that, after fucking about for hours in a project that uses rspec today. Mocks *everywhere*
<andrewvos> So many
<andrewvos> So so many
<andrewvos> And I have to work on it tomorrow
<andrewvos> Right I'm going to sleep
<injekt> andrewvos: what you using for it? :)
<drbrain> I once asked "how can I be the ruby official person thingy for freenode"
<rue> Weakling
<drbrain> and a freenode staff member said "you need to get matz to sign off"
Indian has joined #ruby-lang
<andrewvos> injekt: Using for what?
<drbrain> and I said "I know matz!"
<injekt> andrewvos: irc
<drbrain> and I got laughed at
<injekt> drbrain: lol
<drbrain> so that was the end of that
<injekt> wait that's not helping
<zenspider> drbrain: so get matz to sign off on it
<injekt> ^
<rue> drbrain: It's marginally easier now, FWIW
nilibanili has joined #ruby-lang
<rue> I emailed -core recentlyish, but I don't think anyone ever responded to that
<andrewvos> injekt: Uhh the ruby one I think.. or was it hubot?
<andrewvos> Yeah hubot
<drbrain> zenspider: they wouldn't tell me how that happened
<injekt> andrewvos: coffeescript
<andrewvos> oh right
<andrewvos> <3 coffeescript
<injekt> I still can't get used to it
gregf has joined #ruby-lang
<deryldoucette> i haven't even played with it yet. nothing i'm doing requires it (yet)
<andrewvos> deryldoucette: That's what she siad
<andrewvos> said*
<deryldoucette> heh
<andrewvos> Wait didn't I say I was going to sleep?. Ok that's happening. Night
<deryldoucette> later. my rottie is beggin me to play with her for a bit so.. i'm off too. Night
DEac- has joined #ruby-lang
<shevy> rotten wife??
<andrewvos> shevy: I was thinking that too
<zenspider> god I love rsync 3
<cout> zenspider: the movie?
<rue> Straight to video
<andrewvos> hahaha
MistyM has joined #ruby-lang
<deryldoucette> lol, sometimes i think she thinks she is my rotten wife
<deryldoucette> my rottweiler
QoQOoO has joined #ruby-lang
<cout> rot while her what?
jtoy has joined #ruby-lang
QoQOoO has joined #ruby-lang
looopy has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
srbaker has joined #ruby-lang
ttilley has joined #ruby-lang
gix has joined #ruby-lang
andkerosine has joined #ruby-lang
ta8let has joined #ruby-lang
ta8let has quit [#ruby-lang]
SuperTaz_work has joined #ruby-lang
savage- has joined #ruby-lang
QoQOoO has joined #ruby-lang
rushed has joined #ruby-lang
shtirlic has joined #ruby-lang
macmartine has joined #ruby-lang
muzone has joined #ruby-lang
<andkerosine> How to build the setter for a multi-dimensional array?
<andkerosine> For instance, config['x']['y] = z
<andkerosine> Without having to keep writing to the file after every change?
<theconartist> don't write the file after every change?
<andkerosine> It is necessary for proper functioning.
<theconartist> but you just said you don't want to..?
<erikh> who's on first?
<andkerosine> I meant without doing it explicitly.
<andkerosine> I'd like to create a setter that does the writing.
<theconartist> well just make a method for it
<theconartist> you could make the config a singleton so it's like config[x,y] = z; or something
andrewhl has joined #ruby-lang
bhrgunatha has joined #ruby-lang
<rue> Multiple args withit [] is the best you can do, yes, or then you need to provide a proxy returned by #[], which implements #[]= as you need it to
bitrot has joined #ruby-lang
elux has joined #ruby-lang
neoesque has joined #ruby-lang
dv310p3r has joined #ruby-lang
andrewhl has joined #ruby-lang
tomzx has joined #ruby-lang
<andkerosine> So, I would really like for it to work like this, and I think I'm really close: https://gist.github.com/1889771
WillMarshall has joined #ruby-lang
<andkerosine> But the initialize is returning an empty hash.
<andkerosine> If I write a load method that returns the hash, that works fine, but then I have to set @config to Config.new.load, which then doesn't let me assign to it later.
<lsegal> you're not doing anything with your JSON.parse object
<lsegal> andkerosine delegation is always preferred to inheritance
havenn has joined #ruby-lang
wyhaines has joined #ruby-lang
gnufied has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
gfarfl has joined #ruby-lang
WillMarshall has joined #ruby-lang
macmartine has joined #ruby-lang
<bnagy> lsegal: why? :)
rohit has joined #ruby-lang
<bnagy> I'll bear that in mind next time I'm writing Java :>
<bnagy> I mean I don't disagree that ruby's DelegateClass etc are cool, but the word 'always' brings out the pedant in me
<lsegal> design principles are language agnostic
<lsegal> when i said delegation i didn't necessarily mean "delegateclass"
<lsegal> i meant composition where most of the interface is delegated to the composed object
RomyRomy has joined #ruby-lang
rohit has joined #ruby-lang
havenn has joined #ruby-lang
twelvechairs has joined #ruby-lang
<bnagy> ok, sounds like buzzwords to me :) There are plenty of use cases where inheritance is clean, easy to read and write and works perfectly
<RomyRomy> Hello, I write to inquire if anyone here has successfully deployed an octopuses blog
<RomyRomy> sigh.
<RomyRomy> Octopress, i meant, thanks to autocorrect.
<deryldoucette> i have one. took all the defaults except for enabling some of the plugins and the google+ and git stuff.
<deryldoucette> serves my needs at that level of commitment for the time being. using it with github's pages support for a project i'm working on.
coreydaley has joined #ruby-lang
twittard has joined #ruby-lang
jredville has joined #ruby-lang
piglop has joined #ruby-lang
<postmodern> question, why doesn't URI automatically escape the query string?
Karmaon has joined #ruby-lang
Karmaon has joined #ruby-lang
<twelvechairs> is there a simple way to intersect an unknown amount of arrays eg. [[1,2,3,4],[2,3,4,5],[3,4,5,6]].???? # => [3,4]
savage- has joined #ruby-lang
<gfarfl> twelvechairs: [[1,2,3,4],[2,3,4,5],[3,4,5,6]].inject(:&)
<theconartist> damnit i was 1 second late
<andkerosine> Of course, #reduce makes a bit more semantic sense there.
piglop has joined #ruby-lang
heppy has joined #ruby-lang
<postmodern> question, why doesn't URI automatically escape the query string?
<twelvechairs> gfarfl: thanks :)
<postmodern> URI::HTTP.build allows \n characters in the #query string
<postmodern> also Net::HTTP let's them slip into the requests without escaping them
woollyams has joined #ruby-lang
<andkerosine> Who says there isn't a some resource that'll process your \ns?
<andkerosine> -a
<postmodern> the \n causes the HTTP/1.1 to not be parsed properly
<postmodern> causes the server to reject the request
<andkerosine> Then, yes, that server isn't configured to handle them.
<andkerosine> Doesn't mean it's not possible.
<erikh> not that it helps much, but gsub over [^\w] with a .ord.hex should solve your problem
<andkerosine> Technically, query strings aren't part of the URI specification, to answer your question.
<postmodern> erikh, yeah manually calling URI.escape fixes this
<erikh> ah, I see.
<postmodern> erikh, but i thought it odd that URI and Net::HTTP lets \n and \r slip through
<erikh> yeah, that is strange
<erikh> you should get drbrain's attention or submit to the tracker
<erikh> URI has a lot of bugs though, not especially surprising
<erikh> .... and that's because hte URI spec is a fickle bitch
<erikh> does it let any whitespace through or just \n and \r ?
<postmodern> erikh, oh wait https://bugs.ruby-lang.org/issues/5843
<erikh> oh nice
<erikh> haha you submitted it
<erikh> frazzled much ? :)
<postmodern> erikh, yeah forgot about it
<postmodern> erikh, and yes much frazzled
<erikh> well p125 is out now, fwiw
<erikh> it probably has your fix in it -- it was only released a few days ago
gianlucadv has joined #ruby-lang
MistyM has joined #ruby-lang
<postmodern> erikh, looks like it's still not fixed in 125
<erikh> hum. phooey
<duckinator> heftig: thanks for pointing out ruby_debug == $DEBUG before. i think i got it narrowed down to two possibilities causing $DEBUG to fix this bug, now :D
pp01bit has joined #ruby-lang
<lsegal> bnagy the problem is it doesn't work perfectly. subclassing Hash will often lead you to edge cases where things don't work as expected unless you've overridden the entire Hash interface to delegate to the proper functionality, which is why composition is superior
<lsegal> bnagy [], []= are the obvious ones, but then there is merge, merge!, update, replace, and more.
ramu3 has joined #ruby-lang
<duckinator> I'm working safe ruby eval in pure ruby, and AFAIK the only bug is sleep() w/ no args hangs endlessly. https://github.com/duckinator/sicuro/blob/master/lib/sicuro/base.rb#L85-98 the Timeout.timeout{...} is where the evaluated code is ran. One of the behaviors in MRI changed when $DEBUG==true fixes this issue, but I can't track it down.
bhrgunatha has joined #ruby-lang
<duckinator> i've narrowed it down to 2 possible locations in MRI's source (it may be elsewhere -- i started with everything referencing ruby_debug/$DEBUG and trimming down the list): https://github.com/ruby/ruby/blob/trunk/thread.c#L480-484 and https://github.com/ruby/ruby/blob/trunk/eval.c#L402-433 ... any insight would be much appreciated
looopy_ has joined #ruby-lang
Jade has joined #ruby-lang
robertcarter has joined #ruby-lang
Luxx_ has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
<hagabaka> in https://blogs.kde.org/node/2679, at the end of extconf.rb it says 'exec "/opt/kde4/bin/moc #{$CPPFLAGS} testobject.h -o moc_testobject.cpp"'. It's not working for me because $CPPFLAGS is " $(DEFS) $(cppflags)". Was it meant to generate a line in the Makefile, instead of executing the command when running extconf.rb?
<bnagy> lsegal: conflating 'some' with 'all' is not a great debating technique, imho. Yes, in some cases subclassing can give rise to issues. In many it works perfectly. In all it is shorter to write and easier to read.
<bnagy> which is why it's used so much, including in the language itself
kitallis has joined #ruby-lang
<lsegal> bnagy the point is that it's *preferred*; there are many other benefits to composition over inheritance that cover the other issues. i think you have the argument reversed. yes, sometimes you can get away with inheritance, but it's not often the preferred design choice.
dfr|mac has joined #ruby-lang
<bnagy> I have no view on often versus sometimes versus rarely, only on 'never'
dfr|mac_ has joined #ruby-lang
<bnagy> so I therefore declare this argument over :>
twittard has joined #ruby-lang
kitallis has joined #ruby-lang
gianlucadv has joined #ruby-lang
gokul has joined #ruby-lang
rohit has joined #ruby-lang
x0F_ has joined #ruby-lang
kitallis has joined #ruby-lang
woollyams has joined #ruby-lang
gnufied1 has joined #ruby-lang
bcardarella has quit [#ruby-lang]
yxhuvud has joined #ruby-lang
dc5ala has joined #ruby-lang
takaokouji has joined #ruby-lang
whatasunnyday has joined #ruby-lang
thone_ has joined #ruby-lang
rippa has joined #ruby-lang
leon1024 has joined #ruby-lang
whatasunnyday has joined #ruby-lang
amerine has joined #ruby-lang
Go has joined #ruby-lang
uniqanomaly has joined #ruby-lang
maek has joined #ruby-lang
<maek> if I have an array of hashes, like so https://gist.github.com/1891181 how do I iterate over the hash values. I need the values of each has for a config line for hadoop.
<bnagy> a.each {|hsh| hsh.each {|k,v| # do something} }
<maek> bnagy: thats giving me https://gist.github.com/1891181#comments
<maek> bnagy: sorry thats formatted poorly
<maek> bnagy: https://gist.github.com/1891181 thats better
<maek> how do you do it if you want o access every k,v pair in the single hash at a time
<maek> or is that something you cant do
<bnagy> that's what you're doing
twelvechairs has joined #ruby-lang
<bnagy> except you have a key :name and a key :value
<maek> bnagy: so if the hash as 10 k,v pairs that will just go through all 10 for each instance of k v ?
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
<maek> sorry so confused let me try something else
<bnagy> if possible, I would just have { 'fs.default.name' => 'hdfs://hadoop1-001:54310' }
<maek> bnagy: also thanks!
<bnagy> but otherwise a.each {|hsh| "key is #{hsh[:name]} value ie #{hsh[:value]}"}
twelve_chairs has joined #ruby-lang
<maek> bnagy: oh thats even better, your suggestion for the name => value. let me bang on that for a bit. ty!
<bnagy> also, if you do it that way, you can just use one hash and not an array of 2 element hashes :)
<maek> key value pair = element?
ostapbender has joined #ruby-lang
<bnagy> {'fs.default.name'=>'blah', 'make.hadoop.suck.less'=>'true' ...} etc
<bnagy> you can store all your settings in a single hash, then
<maek> ok ty, better and better
<maek> was making a bunch of single element hashs
<maek> obvious noob is obvious. thanks for the schooling
mytrile has joined #ruby-lang
<bnagy> no worries
takaokouji has joined #ruby-lang
ostapbender has quit [#ruby-lang]
twelvechairs has joined #ruby-lang
mytrile has joined #ruby-lang
alim has joined #ruby-lang
brownies has joined #ruby-lang
kitallis has joined #ruby-lang
brianpWins has joined #ruby-lang
mytrile has joined #ruby-lang
mytrile has joined #ruby-lang
mytrile_ has joined #ruby-lang
mytrile has joined #ruby-lang
bhrgunatha has joined #ruby-lang
tla has joined #ruby-lang
Indian has joined #ruby-lang
mytrile has joined #ruby-lang
dfr|mac has joined #ruby-lang
gianlucadv has joined #ruby-lang
bjensen has joined #ruby-lang
Asher1 has joined #ruby-lang
mytrile has joined #ruby-lang
solars has joined #ruby-lang
Asher has joined #ruby-lang
frangiz has joined #ruby-lang
<hagabaka> how can I define a module function in a C extension, so that I call it with TheModule.the_method?
<hagabaka> oh rb_define_singleton_method
workmad3 has joined #ruby-lang
<cout> yep
cyri_ has joined #ruby-lang
<hagabaka> how can I return a ruby string from a const char* in an extension?
riffraff has joined #ruby-lang
d3vic3 has joined #ruby-lang
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
<yorickpeterse1> Morning
<lsegal> hagabaka rb_str_new2(), though you may want to add an encoding
<cout> hagabaka: rb_str_new2(str)
<yorickpeterse1> Morning
yorickpeterse1 has joined #ruby-lang
<yorickpeterse> Sorry for that, that was a failing up key :)
pp01bit has joined #ruby-lang
<hagabaka> thanks
Banistergalaxy has joined #ruby-lang
roadkith has joined #ruby-lang
<tla> can anyone explain the magic of ruby's _ ?
gix has joined #ruby-lang
bjensen has joined #ruby-lang
tekin has joined #ruby-lang
<hagabaka> what am I doing wrong in http://codepad.org/HKQQ36II ? getting In function ‘void Init_QuasselTypes()’: quassel_types.cpp:17:73: error: invalid conversion from ‘VALUE (*)(VALUE, VALUE) {aka long unsigned int (*)(long unsigned int, long unsigned int)}’ to ‘VALUE (*)(...) {aka long unsigned int (*)(...)}’ [-fpermissive]
zmack has joined #ruby-lang
zmack has joined #ruby-lang
vmoravec has joined #ruby-lang
<erikh> hagabaka: I suspect it's something with C++
<erikh> works fine
<hagabaka> oh
<hagabaka> wrapping the whole thing inside extern "C" doesn't help :/
<erikh> phooey
<erikh> C++ is much more anal about types than C is
<erikh> I'm not much of a C++ guy though, so I'll shut up now
<tla> from what I can tell _ holds the result of the last expression evaluated - true?
<erikh> I'm not sure what it returns, just its use in assignments
<erikh> _, a = 1, 2 (1 assigns to nothing)
<brownies> i believe it's used as a throwaway variable for assignments
<brownies> and that's about it
<erikh> right
<tla> ah ok
<rippa> tla: it holds result of last expression only in irb and pry
riffraff has joined #ruby-lang
Caius has joined #ruby-lang
the_dead_serious has joined #ruby-lang
<tla> rippa: ok, I noticed it in ".sort_by do |(host, location, _, _)|" in Rack::URLMap, and it seemed kinda strange
<rippa> that is kinda strange
<hagabaka> values are assigned to block arguments, so it's the same idea, to throw away those last two elements
<rippa> sort_by do |(host, location)|
<rippa> would work too
<rippa> or sort_by do |(host, location, *)|
<rippa> what's fun is
<rippa> if you do |(host, location, derp, derp)|
<rippa> ruby complains about repeated argument
<rippa> but with _, _ it works
<rippa> so it's a special case
<tla> thanks
csherin has joined #ruby-lang
EvilJStoker_ has joined #ruby-lang
rohit has joined #ruby-lang
virunga has joined #ruby-lang
banisterbaby has joined #ruby-lang
<banisterbaby> can anyone think of a way to determine whether a proc takes a block?
<banisterbaby> i.e if it was defined as: proc { |&block|
EvilJStoker_ has joined #ruby-lang
Wardrop has joined #ruby-lang
havenn has joined #ruby-lang
<rue> Hm, maybe you could round-trip it?
<rue> Although apparently #parameters shows it so you don't need to
<banisterbaby> rue: i need to support 1.8 though what did u mean by round-trip it, eero?
<rue> Stupid 1.8
<rue> banisterbaby: You could just detect 1.8 and hardcode it to false
<banisterbaby> rue: Yeah
futurechimp has joined #ruby-lang
virunga has joined #ruby-lang
workmad3 has joined #ruby-lang
<andrewvos> hahaha
<andrewvos> Sounds legit
daglees has joined #ruby-lang
daglees has joined #ruby-lang
QoQOoO has joined #ruby-lang
<hagabaka> is there something like p() in C extensions?
<rue> hagabaka: Sure, #p
<hagabaka> how do I call it in C code?
<rue> (You can always rb_funcall(), but I think there's an rb_inspect(), too.)
<hagabaka> what object do I pass to rb_funcall?
<shevy> the pony object
<shevy> VALUE arr;
<shevy> arr = rb_iv_get(self, "@arr");
<shevy> rb_funcall(arr, id_push, 1, obj);
<hagabaka> but isn't p defined for Kernel?
<shevy> obj is passed into the function
<shevy> oh I dont know much about p
<hagabaka> hmm rb_mKernel
tekin has joined #ruby-lang
<banisterbaby> hagabaka: rb_p
<hagabaka> ah, thanks
QaDeS has joined #ruby-lang
<hagabaka> does RSTRING_PTR give the const char* of the string?
<banisterbaby> hagabaka: Yeah
tekin has joined #ruby-lang
<tla> another question: |foo,bar| vs |(foo,bar)| ?
<rippa> tla: second splits array
vmoravec has joined #ruby-lang
<tla> rippa: ah, thanks
postmodern has joined #ruby-lang
bosie has joined #ruby-lang
twelvechairs has joined #ruby-lang
havenn has joined #ruby-lang
chendo has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
countskm has joined #ruby-lang
EvilJStoker has joined #ruby-lang
woollyams has joined #ruby-lang
m3nd3s has joined #ruby-lang
rippa has joined #ruby-lang
apeiros_ has joined #ruby-lang
codewrangler has joined #ruby-lang
woollyams has joined #ruby-lang
mytrile has joined #ruby-lang
<nofxx_> hehe ~40 min for a big leap in unix time.... 1330000000
woollyams has joined #ruby-lang
rohit has joined #ruby-lang
<Wardrop> Would anyone be able to explain why in my code, referring to the constant Allocation works fine, but using const_get(:Allocation) fails?
<Wardrop> I've resorted to using eval(const_name) to lookup the constant, but I don't understand why const_get is not working?
stamina has joined #ruby-lang
<rue> You're trying to get it in the wrong place, maybe?
<rue> Need codes
<apeiros_> Wardrop: const_get == self.const_get, self should be the module that contains Allocation
<Wardrop> But shouldn't it lookup with inheritance, which is set to true by default. So if the constant I'm looking for is defined in the same module, shouldn't it find it.
chendo has joined #ruby-lang
<Wardrop> I'm calling const_get from a Padrino controller (if you're familiar with the framework). The controller is defined as a block which is then instance_eval'd against the web application object. I can imagine that with the instance_eval, const_get may be getting screwed up.
<banisterbaby> Wardrop: ensure that you're calling const_get on the correct object then
<banisterbaby> pass in an explicit receiver
<banisterbaby> use*
gokul has joined #ruby-lang
Oloryn_lt1 has joined #ruby-lang
<Wardrop> I'll use the module the constant lives in then. E.g. Tombstone.const_get(:Allocation). It's just unusual how the lookup works fine if Allocation is referenced directly. I wonder if it's to do with block scoping. Allocation exists in-scope where the block is defined, but is out of scope where the block is instance_eval'd.
<Wardrop> I guess constants are resolved when the block is defined, where as #const_get resolves constants when the block is invoked.
<Wardrop> That's probably what's happening.
<andrewvos> What's going on here?
<rue> Where's my horse?
<andrewvos> Who are all these people?
bjensen has joined #ruby-lang
t0h has joined #ruby-lang
voker57 has joined #ruby-lang
rohit has joined #ruby-lang
slyphon has joined #ruby-lang
vmoravec has joined #ruby-lang
diegoviola has joined #ruby-lang
cesario has joined #ruby-lang
Wardrop has joined #ruby-lang
niklasb has joined #ruby-lang
rshackleford has joined #ruby-lang
bosie has joined #ruby-lang
havenn has joined #ruby-lang
zmack_ has joined #ruby-lang
QaDeS has joined #ruby-lang
Indian has joined #ruby-lang
Austin__ has joined #ruby-lang
nilibanili has joined #ruby-lang
zmack has joined #ruby-lang
jasiek has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
publicvoid has joined #ruby-lang
tommyvyo has joined #ruby-lang
riffraff has joined #ruby-lang
gnufied has joined #ruby-lang
rippa has joined #ruby-lang
tcurdt has joined #ruby-lang
malev has joined #ruby-lang
willdrew has joined #ruby-lang
malev has joined #ruby-lang
<TTilus> rue: now that was john wayne, right?
fayimora_ has joined #ruby-lang
<rue> Close, George Carlin.
anthony has joined #ruby-lang
fayimora has joined #ruby-lang
MistyM has joined #ruby-lang
<andrewvos> Wow, I see there has been quite the conversation in my absence
* andrewvos joins #ruby
retro|cz has joined #ruby-lang
daniel has joined #ruby-lang
robbrit has joined #ruby-lang
awacs has quit [#ruby-lang]
workmad3_ has joined #ruby-lang
bhrgunatha has joined #ruby-lang
jxie has joined #ruby-lang
<ddfreyne> why #ruby?
mgraham has joined #ruby-lang
pemeon has joined #ruby-lang
gjaldon has joined #ruby-lang
wyhaines has joined #ruby-lang
seanstickle has joined #ruby-lang
<heftig> ddfreyne: because bigger
sockmonk has joined #ruby-lang
Sailias_ has joined #ruby-lang
gongo has joined #ruby-lang
ave_ has joined #ruby-lang
tomzx has joined #ruby-lang
enebo has joined #ruby-lang
jxie has joined #ruby-lang
bjensen has joined #ruby-lang
tekin has joined #ruby-lang
slyphon has joined #ruby-lang
tbuehlmann has joined #ruby-lang
crazy_boy has joined #ruby-lang
dfr|mac has joined #ruby-lang
neoesque has joined #ruby-lang
Spooner has joined #ruby-lang
JEG2 has joined #ruby-lang
solars has joined #ruby-lang
dv310p3r has joined #ruby-lang
pp01bit has joined #ruby-lang
leonL has joined #ruby-lang
adambeynon has joined #ruby-lang
mistym has joined #ruby-lang
tcurdt has quit [#ruby-lang]
Slackwise_ has joined #ruby-lang
leonL_ has joined #ruby-lang
ascarter has joined #ruby-lang
alim has joined #ruby-lang
optikalmouse has joined #ruby-lang
<optikalmouse> how can I generate a class diagram for ruby/rails files?
rayners has joined #ruby-lang
<deryldoucette> damn i know this one. there was a gem that did classes, gems, gem deps, ect.
<deryldoucette> can not remember its name.
<deryldoucette> optikalmouse: try checking through gem search graph -dr
<deryldoucette> (description and check remote is the -dr)
<optikalmouse> deryldoucette: so gem search --details --remote graph does the same thing?
<ave_> railroad works for rails if thats any good
dous has joined #ruby-lang
<deryldoucette> thats the long form of the same params, but yes. it searches rubygems.org for anything with graph in its gem name and returns it along with the description
bryancp has joined #ruby-lang
<deryldoucette> optikalmouse: gem list ograph -dr something like that what you looking for?
Oloryn_lt1 has joined #ruby-lang
ascarter has joined #ruby-lang
<optikalmouse> maybe railroad is what I'm looking for: http://railroad.rubyforge.org/
<ave_> there are a couple of patches you have to make to work with 1.9.2+ I think
<optikalmouse> we're using ruby 1.8.x, and it's jruby in fact lol
<optikalmouse> so I think it should be good? we'll see, I'm running it now...
<deryldoucette> if thats not it, might want to fire off a tweet to @headius (he's head of jruby project) and see what he offers
dous_ has joined #ruby-lang
NARKOZ has joined #ruby-lang
darkf has joined #ruby-lang
<optikalmouse> deryldoucette: it just seems to run the rails app and forgets about generating a diagram lol
futurechimp has joined #ruby-lang
<deryldoucette> doh!
<optikalmouse> there's a way to add it as a rake task but I'm not sure how that would help...
<Harzilein> hmm
<Harzilein> are there archives of the old rubygarden wiki?
codewrangler has joined #ruby-lang
Rabbitt has joined #ruby-lang
virunga has joined #ruby-lang
<shevy> Harzilein probably on that thing that is called the internet archive (eh, I forgot the real name...)
outoftime has joined #ruby-lang
dejongge has joined #ruby-lang
imajes has joined #ruby-lang
<Rabbitt> shevy: only saw part of your conversation but, sounds like you are referring to the way back machine? (www.waybackmachine.org)
jMCg has joined #ruby-lang
<jMCg> Hello happy people o/~
<jMCg> I'm wondering if anyone cann tell me what happens when I connect via Ldap::Conn to a host via SSL or StartTLS and the certificate is invalid (date, host, chain) -- it's not stated in the documentation.
<Harzilein> yeah, i tried that. only problem is that it looks like the links werent very crawler friendly and it missed the page that is referenced (a draft on trying to get aop features into core/stdlib)
looopy has joined #ruby-lang
gnufied has joined #ruby-lang
gnufied1 has joined #ruby-lang
wyhaines has joined #ruby-lang
havenn has joined #ruby-lang
Slackwise has joined #ruby-lang
JohnBat26 has joined #ruby-lang
piglop has joined #ruby-lang
slyphon has joined #ruby-lang
heppy has joined #ruby-lang
slimfit has joined #ruby-lang
maek has quit [#ruby-lang]
looopy has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
piglop has joined #ruby-lang
dfr|mac has joined #ruby-lang
<shevy> Rabbitt yeah I think that was it
ascarter has joined #ruby-lang
apeiros_ has joined #ruby-lang
workmad3 has joined #ruby-lang
<andrewvos> Right, where is banister
malev_ has joined #ruby-lang
carlosgaldino has joined #ruby-lang
<cout> why banister?
<shevy> noone kisses better
<andrewvos> hahaha
pogopolice has joined #ruby-lang
gokul has joined #ruby-lang
looopy has joined #ruby-lang
malev has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
<whitequark> shevy: wayback machine
<whitequark> you know, the rubygarden was waaaay too long ago to survive
andkerosine has joined #ruby-lang
<andkerosine> Is this a horrible way to implement persistent config? https://gist.github.com/1893873
<whitequark> andkerosine: @config.merge! will_not: 'be saved'
andrewhl has joined #ruby-lang
<whitequark> in other words, yes.
davidw has joined #ruby-lang
<whitequark> I would suggest a slightly more horrible, but also working way to do what you want
<davidw> I'm trying to do some define_methods that appear only in the current instance... and I'm a bit stumped
kitallis has joined #ruby-lang
<andkerosine> whitequark: All config is still manually controlled by me, I just don't want File#write everywhere, so the lack of #merge! is a non-issue.
<whitequark> andkerosine: wrap a hash inside your Config and freeze it. forward all requests from your Config with method_missing to that hash. catch RuntimeError "frozen hash", unfreeze it, repeat the request, save it and freeze it back
<whitequark> have I mentioned I like perversions?
<andkerosine> That... does sound a bit excessive.
<whitequark> it's like 10 lines of code
<shevy> whitequark tell me more about which perversions you like
<shevy> also, I hate .freeze
<riffraff> davidw, use define_method on the singleton class of the object
<davidw> riffraff, class << self.....
<riffraff> yup, if you don't have a singleton_class method handy
<riffraff> class << obj; works anyway
<whitequark> shevy: I dislike freeze, but only if it's applied on `self' in my instance context.
<whitequark> otherwise it's fine. just like .immolate
<whitequark> andkerosine: like this https://gist.github.com/1893903 (untested but shoulda work)
<shevy> what is .immolate?
<mistym> It burns your object (with fire).
<whitequark> mistym: thanks, Captain
<davidw> riffraff, ok, I had gotten that far... the tricky bit is I'm trying to pass in different parameters. If this is defined, create these methods from these parameters (more or less)
<davidw> ugh... this is a mess
amerine has joined #ruby-lang
looopy has joined #ruby-lang
havenn_ has joined #ruby-lang
csherin has joined #ruby-lang
<andkerosine> whitequark: Too perverse, but good thought food.
<andkerosine> I imagine I would have to take a route somewhere along those lines if I wanted to completely re-implement Hash with persistence, but I really just need a slightly tweaked []=.
<riffraff> davidw, sample code please :) seems to me " def define_foo(obj,bar) unless obj.respond_to?(:foo); obj.singleton_class.send(:define_method, :foo) {code based on bar} end end" should fit but I guess it's not what you need
looopy has joined #ruby-lang
macmartine has joined #ruby-lang
butchanton has joined #ruby-lang
headius has joined #ruby-lang
heppy has joined #ruby-lang
coreydaley has joined #ruby-lang
<davidw> ugh... got it to pass the tests...
<davidw> but it's slow
<davidw> hrm
aprescott has joined #ruby-lang
aprescott has quit [#ruby-lang]
<davidw> ok, so how about this... how to have one method that I can 1) call to define some methods in a module, but also call to define some methods in an instance
<davidw> whack-a-mole.... hit it ther and it pops up over there
bglusman has joined #ruby-lang
mgraham has joined #ruby-lang
jredville has joined #ruby-lang
<riffraff> how about def pseudo_define(o,m,&b) (o.respond_to?(:define_method) ? o : o.singleton_class).send(:define_method, m, &b) end ?
<riffraff> multiple definitions goes naturally
<riffraff> but I'm wondering if whwt you want is get a Foo instance in which does not respond to :meth, define a method :meth for all Foo instances
<riffraff> only, Foo is not a class but a module
<riffraff> not sure which module though
achiu has joined #ruby-lang
ascarter has joined #ruby-lang
<mistym> davidw: Not sure exactly what you're going for, but what about sending a block that's `instance_eval`ed in different contexts?
zerokarmaleft has joined #ruby-lang
achiu has joined #ruby-lang
<davidw> hrm... it's difficult even to describe
<davidw> let's see.... I have a class, with some methods that should be available in 'default' cases, but not in others. Creating those methods is sort of expensive (parsing a file), so I'd like to 1) create them inside a module, but 2) only include them in the instances that need them, so as not to pollute other instances
<apeiros_> davidw: see Object#extend
slaytanic has joined #ruby-lang
Sailias_ has joined #ruby-lang
gianlucadv has joined #ruby-lang
twittard has joined #ruby-lang
<andkerosine> apeiros_: Differences, if any, between Object#extend and include?
pemeon has joined #ruby-lang
<apeiros_> andkerosine: for starters, that extend is on Object, include on Module
<apeiros_> try "foo".include Bar
<andkerosine> Hm.
<riffraff> davidw, #extend seems the thing yup
<andkerosine> I only ask because right now I've got a bunch of single-method modules that I'm using as mixins to only expose relevant functionality to my objects.
<andkerosine> But I hate the way it looks.
<andkerosine> But the objects are classes, so it seems like the most sensible way to go about it.
<apeiros_> o0
<andkerosine> ...?
<andkerosine> "my objects" was meant loosely, and I certainly could've gone with a better word.
heppy has joined #ruby-lang
slimfit has joined #ruby-lang
jredville has joined #ruby-lang
Faris has joined #ruby-lang
dfr|mac has joined #ruby-lang
jacobwg has joined #ruby-lang
m3nd3s has joined #ruby-lang
maek has joined #ruby-lang
<maek> is it bad mojo to make a :SYMBOL all upper case?
<matled> maek: well, convention is to use lower case and underscores.
bagratte has joined #ruby-lang
<maek> matled: ty
slyphon has joined #ruby-lang
woollyams has joined #ruby-lang
<drbrain> maek: it's not unheard of: ruby -e 'p Object.constants'
slyphon_ has joined #ruby-lang
<hagabaka> yeah, it's more a convention about method/module names, than about symbols
rue has joined #ruby-lang
Sailias_ has joined #ruby-lang
<maek> thanks
postmodern has joined #ruby-lang
robertcarter has joined #ruby-lang
tbuehlmann has joined #ruby-lang
JohnBat26 has joined #ruby-lang
gix has joined #ruby-lang
mistym has joined #ruby-lang
tla has joined #ruby-lang
joshkraemer has joined #ruby-lang
tekin has joined #ruby-lang
Faris has joined #ruby-lang
<Faris> Hello, how could I read raw binary data from a file in ruby ?
<Faris> I'm trying to do it with IO.read but it doesn't read bytes like 0x0D
<apeiros_> File.read(path, 'wb:binary')
<apeiros_> ah, wrong
<Faris> rb ?
<apeiros_> File.read(path, :encoding => 'binary')
<apeiros_> yeah, that'd have been 2 mistakes :)
<Faris> and that will also read 0x0D's ?
<Faris> :)
<apeiros_> it's File.open that takes the args like that.
<apeiros_> yes
<Faris> thank you !
<Faris> so the 'rb' argument isn't really binary reading ?
<apeiros_> given that 0x0d is \r, even without binary setting, it should be read…
<Faris> it isn't in my case :(
<apeiros_> Faris: partially, rb is for File.open, not File.read. the binary there is only for windows
<Faris> oh ok
<apeiros_> in windows you have text vs. binary mode. it's unrelated to the encoding of the file
<apeiros_> it's only about how newlines should be treated
<apeiros_> IMO a silly thing, but well, what do we expect… it's windows…
<Faris> okey.
<Faris> actually 0x0D's are read
<Faris> but there's a 0D 0A sequence in which only 0A is read
<Faris> using my old method
<apeiros_> so you're on windows then?
<Faris> I'll try yours..
<Faris> nope
<Faris> Linux
<apeiros_> o0
<Faris> the file was created under windows though
<apeiros_> that's odd then… you sure it happens at read-time?
<apeiros_> \r\n shouldn't be converted to \n anywhere but on windows…
<apeiros_> (0d 0a == \r\n)
<Faris> When I read the file with a hex editor under windows, I can see the \r \n
<Faris> but when I read it with ruby on linux, it only reads \n
<heftig> File.read("foo", mode: "rb") should work
<Faris> okey
workmad3 has joined #ruby-lang
<heftig> if it doesn't, the file might have been modified when you transferred it to your linux system
<heftig> ftp does that.
<Faris> ooh
<Faris> that must be it
<Faris> that culprit
<heftig> make sure ftp uses BINARY mode and not ASCII mode for transfer
<Faris> okey
<heftig> (it's a client setting)
<Faris> thanx :)
Karmaon has joined #ruby-lang
whatasunnyday has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
curtism has joined #ruby-lang
curtism has joined #ruby-lang
bryancp has joined #ruby-lang
alim_ has joined #ruby-lang
dejongge has joined #ruby-lang
virunga has joined #ruby-lang
fayimora has joined #ruby-lang
nacengineer has joined #ruby-lang
justinmcp has joined #ruby-lang
eydaimon has joined #ruby-lang
eydaimon has joined #ruby-lang
eydaimon has joined #ruby-lang
nacengineer has joined #ruby-lang
ascarter has joined #ruby-lang
rushed has joined #ruby-lang
eyda|mon has joined #ruby-lang
eyda|mon has joined #ruby-lang
slimfit has joined #ruby-lang
jacktrik has joined #ruby-lang
eyda|mon has joined #ruby-lang
eyda|mon has joined #ruby-lang
brownies has joined #ruby-lang
robbrit has quit [#ruby-lang]
malev_ has joined #ruby-lang
Gekz has joined #ruby-lang
gregf has joined #ruby-lang
havenn_ has joined #ruby-lang
workmad3 has joined #ruby-lang
davidw has joined #ruby-lang
eyda|mon has joined #ruby-lang
eyda|mon has joined #ruby-lang
daglees has joined #ruby-lang
daglees has joined #ruby-lang
stamina has joined #ruby-lang
lsegal has joined #ruby-lang
rue has joined #ruby-lang
l0st1 has joined #ruby-lang
Wardrop has joined #ruby-lang
maek has quit [#ruby-lang]
woollyams has joined #ruby-lang
virunga has joined #ruby-lang
workmad3 has joined #ruby-lang
volty has joined #ruby-lang
Wardrop has joined #ruby-lang
rushed has joined #ruby-lang
carlosgaldino has joined #ruby-lang
macmartine has joined #ruby-lang
<muzone> how'd you guys mirror all of http://www.awesometapes.com/ and http://moroccantapestash.blogspot.com/ into an organized collection?
<apeiros_> wget
<apeiros_> ruby is nice and all, but the right tool for the right job…
havenn_ has joined #ruby-lang
<muzone> cool, i understand
<muzone> apeiros_: you know how with wget?
<muzone> aint nobody in #wget hehe
<apeiros_> no, but google 'wget mirror website'
<apeiros_> there should be plenty
<muzone> thanks man
<apeiros_> seems `wget -mk -w 3 URL` should get you somewhere
<apeiros_> (that does a 3s delay between each download - just to be nice to that website…)
<muzone> apeiros_: wget -mk -w 3 -A mp3 http://awesometapes.com should work no
rue has joined #ruby-lang
<muzone> Finished, Downloaded: 1 files, 184K in 0,3s (577 KB/s) i guess not
<mistym> muzone: http://archiveteam.org/index.php?title=Wget for a guide
ChloeD has joined #ruby-lang
<shevy> is it possible to display a .pdf file on a .cgi page, all via ruby?
<shevy> the .cgi page works, but I am not sure if I can display a .pdf file
<shevy> (I dont care about the layout much, I am fine if I lose all style-information in that .pdf and just output the text)
Carnage\ has joined #ruby-lang
<burgestrand> Yes, output the PDF data and send the proper mime-type
slyphon_ has joined #ruby-lang
<shevy> hmm
wyhaines has joined #ruby-lang
<S1kx> hm is indextank totally dead nowadays? im getting timeout when im trying to acess the api
srbartlett has joined #ruby-lang
rolfb has joined #ruby-lang
wallerdev has joined #ruby-lang
<S1kx> i suppose ill switch to solr and sunspot again
WillMarshall has joined #ruby-lang
<outoftime> S1kx: might check out elasticsearch
<outoftime> S1kx: it's solr's hot friend
davidw has joined #ruby-lang
<S1kx> outoftime: ah, looks sweet, thanks
seanstickle has joined #ruby-lang
<outoftime> S1kx: no problem. Tire is a nice ruby layer for it.
srbartle_ has joined #ruby-lang
butchanton1 has joined #ruby-lang
Tallboy has joined #ruby-lang
youngin has joined #ruby-lang
<Tallboy> Hey
<Tallboy> could someone answer me a question about rails?
<Tallboy> very simple one
frode15243 has joined #ruby-lang
<seanstickle> Tallboy: not if you don't ask the question
<Tallboy> heh
<Tallboy> basically, how does javascript_include_tag work?
<Tallboy> im trying to find a tutorial online im not really seeing one though
<Tallboy> as of right now its just including any css/js that i put into the assets/javascript /stylesheets folders
<Tallboy> am i supposed to put stuff inside application.css/.js?
<Tallboy> or does it just load everything
<Tallboy> i mean, obviously it loads everything. to clarify i mean am i doing this right where its SUPPOSED to load everything
ttilley has joined #ruby-lang
dfr|mac has joined #ruby-lang
<drbrain> Tallboy: #ror is the best place to ask ruby on rails questions
shevy2 has joined #ruby-lang
<Tallboy> thanks :)
<S1kx> outoftime: very nice, barely took half an hour to set it all up to start working at least with a simple index :P
<outoftime> S1kx: easy bootstrapping is among ES's many pleasures.
El_Matador has joined #ruby-lang
jeffmoss has joined #ruby-lang
butchanton has joined #ruby-lang
jredville has joined #ruby-lang