<mr_blue>
leftylink: great thank you :) I'll check you link
bmurt has joined #ruby
<mr_blue>
leftylink: I there official doc about this ?
<mr_blue>
s/I there/Is there/
renich has quit [Ping timeout: 258 seconds]
<leftylink>
mr_blue: I'm sure there probably is. you will probably be able to find it, now that you know it is called a Refinement. It should be in the docs for versions 2.0.0 and later
AJA4351 has joined #ruby
jyaworski has quit [Ping timeout: 245 seconds]
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
<mr_blue>
leftylink: yes you're right I just found it. Thank again for you time :)
orbyt_ has joined #ruby
Onwarion has joined #ruby
forager has quit [Quit: leaving]
mangold has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
<Swyper>
changing line 12 to coprime? still gives me the same errors
<baweaver>
Fix the indentation as a first step
<baweaver>
Second, what's your method name?
<baweaver>
Third, where is that method defined when you call it on 7 through 10?
<Swyper>
1) done, 2) coprime? 3) the method is defined right below the method call
<Swyper>
is 3) causing the error? does a method need to be defined before its called?
<baweaver>
2: No it's not
<baweaver>
3: Yes
<baweaver>
Ruby isn't that smart.
<Swyper>
okay so in C iirc the options are to 1) define the method before calling it or 2) declare the method signature and define it later on, is it exactly the same for Ruby?
<Swyper>
2) so my method name is 'coprime' not 'coprime?' ?
<Swyper>
if the answer to 2) is yes what does ? mean in the context of ruby
<Swyper>
I have so many errors and I'm not really sure how to look them up since the errors aren't really descriptive
MyMind has joined #ruby
ByronJohnson has quit [Ping timeout: 272 seconds]
Sembei has quit [Ping timeout: 245 seconds]
Swyper has quit [Remote host closed the connection]
<G>
Having a bit of a d'oh moment, what is it in ruby terms when you do something like. method_a.dostuff.domorestuff (i.e. the .dostuff and .domorestuff)
<zenspider>
G: they're either just called method calls or chained method calls... why? what's your doh moment?
am0123 has quit [Ping timeout: 258 seconds]
<G>
zenspider: I was just trying to think of the best term to use while Googling :)
<zenspider>
G: ask me, not google
<G>
Basically, what I'm trying to do is prevent the next chained method from running, because I've already run it - this is a monkey patched method situation.
<zenspider>
so, you have something like obj.a.b.c and you want #b to prevent #c from "running" ?
<G>
Yeah!
<zenspider>
can you explain the "why" a bit more?
<zenspider>
you've monkey patched a class or object to do something custom and you want to be done in the middle?
<G>
Yeah, so the background is, this is within a rails app, and more specifically ActionMailer (just so it's a little less abstract), controller calls MailerClass.send_message.deliver I've monkey patched send_message because we need to do things before and after the MailerClass actually sends the message, so the new send_message kind of looks like: dostuff, resp = orig_send_message.deliver, domorestuff, resp (where commas are linebreaks), but I'm finding .delive
reber has joined #ruby
<TheBrayn>
you could use &. and return nil
<zenspider>
G: the proper way to do that is to subclass, override, and use super w/ your custome prefix/suffix code around the super...
<zenspider>
but... if you are already in the muck... either what TheBrayn said, or you return a dummy that doesn't respond to those chained messages
<zenspider>
I don't actually recommend creating objects like that. Create a DummyMail class, or whatever, and instantiate one. That way you're not mucking with method tables all the time
reber has quit [Remote host closed the connection]
<G>
I don't think TheBrayn's suggestion would work, because the calling controller needs the response, I think I've got to do what you've suggested. Just going to brb while I look at something real quick
<zenspider>
does it need the response? generally you call mailers for side-effect, no?
<G>
Need to record Message-Id's
<zenspider>
also, what are you monkey patching it for? what problem are you trying to solve?
<G>
The mailer service, modifies the message-id from what the application provides, AND what ActionMailer generates, but doesn't replace the Message ID in the returned response, instead it adds to the response hash, the monkey patch is to return the Message ID that was truly used by replacing the message-id
<G>
I'm starting to ponder if it'd be easier to monkey patch that class, wrap around deliver!
<zenspider>
I would suggest NOT changing the return type at all. Instead, store off the value you want in a side instance variable on the response object and access it in the controller
<zenspider>
try to get it as simple as possible. Something like:
<zenspider>
def some_monkey_patched_method; @original_msg_id = @msg_id; super; end
<zenspider>
Then you can also create an accessor method or just use ivar_get to grab it in the crontroller
cnsvc_ has quit [Ping timeout: 256 seconds]
wolfshappen has quit [Ping timeout: 244 seconds]
wolfshappen_ has joined #ruby
jyaworski has joined #ruby
arup_r has joined #ruby
jyaworski has quit [Ping timeout: 250 seconds]
<G>
zenspider: thanks for the help, I managed to get a solution where I didn't have to touch the controllers to get SES working right, think I'll be filing an issue on their github repo though
<zenspider>
you should. thank you
themsay has joined #ruby
arup_r has quit []
am0123 has joined #ruby
blackmesa1 has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
blackmesa1 has quit [Ping timeout: 264 seconds]
ellcs has joined #ruby
xrexeon has joined #ruby
mangold has joined #ruby
conta has quit [Ping timeout: 246 seconds]
Tuor has quit [Ping timeout: 264 seconds]
laaron- has joined #ruby
conta has joined #ruby
xrexeon has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
am0123 has quit [Ping timeout: 245 seconds]
aqd has quit [Quit: Leaving]
jyaworski has joined #ruby
ramfjord has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
ramfjord has quit [Ping timeout: 250 seconds]
jyaworski has quit [Ping timeout: 240 seconds]
stryek has joined #ruby
jyaworski has joined #ruby
mr_blue has quit [Quit: Lost terminal]
chens has quit [Remote host closed the connection]
iMadper has joined #ruby
houhoulis has joined #ruby
Pisuke has joined #ruby
MyMind has quit [Ping timeout: 258 seconds]
jyaworski has quit [Ping timeout: 255 seconds]
arooni has quit [Ping timeout: 245 seconds]
arooni_team_b has joined #ruby
zapata_ has joined #ruby
zapata has quit [Ping timeout: 258 seconds]
houhoulis has quit []
gray_-_wolf has joined #ruby
<zenspider>
Finished in 4.867713s, 1302.2543 runs/s, 5722.3998 assertions/s.
<phaul>
bougyman: the gist did self.class.ancestors.first which confused me. can you explain what that bit of code is supposed to do?
<JayDoubleu>
Hi, I am completely new to ruby. If I want to run bunch of queries on aws and cache it, should I save it to a file and check that file on each run or is there some sort of caching module/plugin available ?
Creatornator has joined #ruby
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Creatornator has joined #ruby
\void has joined #ruby
jcarl43 has joined #ruby
<hightower3>
is "a, b = b, a" atomic in MRI?
galaxie has joined #ruby
<balo>
hightower3: RubyVM::InstructionSequence.compile("a = 1; b =2; a, b = b, a").disasm
prestorium has joined #ruby
<galaxie>
How would I make an array out of the results of calling a method n times?
<elomatreb>
You can use Integer#times with map to get this easily
<hightower3>
galaxie, something as simple as results = []; 10.times do |i| results.push a_method() end ?
[Butch] has joined #ruby
<hightower3>
thanks balo, nice one
<galaxie>
elomatreb: And that's as fast as hightower3's suggestion?
<elomatreb>
Probably equivalent or slightly faster
<bougyman>
phaul: the parent of a child class is looking for its own namespace.
<bougyman>
But this method is defined in its parent class.
<bougyman>
which has a different namespace.
<bougyman>
Module.nesting seems to always choose the parent class's namespace.
orbyt_ has joined #ruby
olspookishmagus has quit [Quit: All for nothing]
ams__ has joined #ruby
bairyn is now known as ByronJohnson
mikecmpbll has joined #ruby
clemens3_ has quit [Ping timeout: 244 seconds]
themsay has quit [Ping timeout: 255 seconds]
<phaul>
I _think_ self.class.ancestors.first is just self.class. To get the parent class there is .superclass
gix has joined #ruby
renich has joined #ruby
<phaul>
that^ is until al2o3-cr arrives with Fiddle :D
jyaworski has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
KeyJoo has joined #ruby
jyaworski has quit [Ping timeout: 250 seconds]
mikecmpbll has joined #ruby
xrexeon has quit [Remote host closed the connection]
href has quit [Remote host closed the connection]
mikecmpbll has quit [Client Quit]
queip has quit [Quit: bye, freenode]
renich_ has joined #ruby
AJA4350 has quit [Remote host closed the connection]
renich has quit [Ping timeout: 245 seconds]
cow[moo] has joined #ruby
AJA4350 has joined #ruby
prestorium has quit [Ping timeout: 250 seconds]
renich_ is now known as renich
ua has quit [Ping timeout: 255 seconds]
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ogres has quit [Quit: Connection closed for inactivity]
bambanx has joined #ruby
Creatornator has joined #ruby
orbyt_ has quit [Ping timeout: 244 seconds]
Creatornator has quit [Ping timeout: 250 seconds]
serverok has joined #ruby
ramfjord has joined #ruby
ua has joined #ruby
serverok has left #ruby [#ruby]
am0123 has joined #ruby
gray_-_wolf has quit [Quit: WeeChat 2.3]
KeyJoo has quit [Quit: KeyJoo]
orbyt_ has joined #ruby
d^sh_ has quit [Ping timeout: 244 seconds]
d^sh has joined #ruby
tdy1 is now known as tdy
jyaworski has joined #ruby
sauvin has quit [Remote host closed the connection]
ericboehs1 has quit [Quit: WeeChat 2.3]
ramfjord has quit [Ping timeout: 268 seconds]
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
jyaworski has quit [Ping timeout: 250 seconds]
am0123 has quit [Remote host closed the connection]
am0123 has joined #ruby
Rapture has quit [Ping timeout: 255 seconds]
reber has joined #ruby
hightower3 has quit [Ping timeout: 244 seconds]
am0123 has quit [Ping timeout: 255 seconds]
xtsee has joined #ruby
jyaworski has joined #ruby
wilbert has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ramfjord has joined #ruby
jyaworski has quit [Ping timeout: 264 seconds]
crankhar1er has joined #ruby
crankharder has quit [Ping timeout: 245 seconds]
postmodern has joined #ruby
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bambanx has quit [Ping timeout: 250 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
orbyt_ has joined #ruby
hiroaki_ has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
cnsvc_ has joined #ruby
Fernando-Basso has joined #ruby
ams__ has quit [Quit: Connection closed for inactivity]
Inline has quit [Read error: Connection reset by peer]
Inline has joined #ruby
marmotini_ has joined #ruby
am0123 has joined #ruby
marmotini_ has quit [Ping timeout: 255 seconds]
am0123 has quit [Ping timeout: 244 seconds]
<zenspider>
phaul: prepend can fuck up that assumption
hightower2 has joined #ruby
reber has quit [Remote host closed the connection]
ams__ has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
<phaul>
zenspider: true
nwradio has quit [Read error: Connection reset by peer]
nwradio has joined #ruby
<phaul>
based on what they said tho, I _think_ they wanted self.class.superclass. as they wanted parent?
<hightower2>
Is there a way to start a thread and not have to join it later after it exits?
wolfshappen has quit [Ping timeout: 255 seconds]
wolfshappen_ has joined #ruby
<ramfjord>
hightower2: after the process exits? All threads will be terminated. After the thread exits? Doesn't join just tell a process to wait for the threads to exit? not sure what you're trying for
<hightower2>
ramfjord, yes (the latter case you describe), but isn't it that until I call join() the thread isn't garbage collected
<hightower2>
I want it to be GC-ed, but without me having to call join or do any cleanup after it decides to exit
<ramfjord>
Ahhh, well I don't know the internals of the GC, but i would think that as the thread finishes it would pop off it's stack, and the reference counter would be able to see that the ojects are collectible. Probably others could answer better than I though.
<ramfjord>
You might be able to test this out by starting a thread which creates a big array and exits, then in the main thread sleep a second or two and call GC.start, all while monitoring the memory usage
<ramfjord>
or do you already know they won't be GC'd in the thread without join?
<hightower2>
ramfjord, I'm pretty sure they're not collected because the return value is still pending - no one retrieved it, and in the list of threads they are still visible even though in state DEAD or whatever
<hightower2>
(whatever the exit status was)
<ramfjord>
separate thread that lists dead threads and joins them :D
<hightower2>
hehe :) possibly :)
moei has quit [Quit: Leaving...]
jyaworski has joined #ruby
<ramfjord>
weirdly when I'm testing this locally I can't seem to reduce the process memory usage with GC.start even after I join the thread
<zenspider>
hightower2: what you're describing is a bad smell
<ramfjord>
yeah, possibly keeping a persistent threadpool with work units and a queue would be better, since there's probably a decent overhead to starting and stopping them
<hightower2>
oh yeah, I assumed thread == a process I run in it, when in fact nothing prevents me from re-using the same thread from starting the process in a loop multiple times
<hightower2>
zenspider, yeah I wasn't intending to really do it the way I asked, unless some favorable answer/option was given
jyaworski has quit [Ping timeout: 250 seconds]
akem has quit [Remote host closed the connection]
akem has joined #ruby
hiroaki_ has quit [Ping timeout: 244 seconds]
hiroaki_ has joined #ruby
polishdub has quit [Quit: leaving]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]