ChanServ changed the topic of #ruby-lang to: Ruby 1.9.3-p125: http://ruby-lang.org | Paste >3 lines of text on http://pastie.org or use a gist
<erikh> busy streets here and the train is nearby and he likes adventure time very much
<erikh> (and he's not getting any younger)
<zzak> zenspider: hes a boss
benanne has quit [Ping timeout: 260 seconds]
esad has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
Kingy has quit [Quit: Leaving]
bastilian has quit [Quit: Linkinus - http://linkinus.com]
kain has left #ruby-lang ["exit"]
<zzak> erikh: you mean this grass? http://screencloud.net/v/CFWN
<erikh> yep :)
<erikh> heh
<erikh> hold on, i'll get you a pic of our cat
<Spaceghostc2c> So, if I have an object I want to be a singleton and I don't want it to be able to be inherited or included/extended, is there a way to arrive at that?
acmiller has quit [Quit: acmiller]
<erikh> I'm sure there are a million on my wife's facebook page
<Spaceghostc2c> I was trying to define an anonymous class using a local variable, but that won't work when requiring the file.
tomzx_ has joined #ruby-lang
<zzak> lol
<zzak> his mom and dad are still together: http://screencloud.net/v/7Y0F
<erikh> yeah, she has a whole freakin album named after him
seoaqua has joined #ruby-lang
<zzak> we have more pictures of our cat than anything
S1kx has quit [Ping timeout: 260 seconds]
<zzak> i dont even remember what my family looks like
<zzak> just their cats
<erikh> can you see that?
<zzak> yeh
<drbrain> erikh: since I use LimeChat, yes, right in my IRC window
<zzak> he looks like my brothers cat floyd
CoverSlide has quit [Ping timeout: 272 seconds]
Carnage\ has quit []
<erikh> yeah, depending on the privacy settings though
<erikh> (and I wasn't sure)
<zzak> like exactly the same
<erikh> super-friendly cat, high energy
<erikh> ... despite the indication the picture might give
<zzak> except floyd weighs as much as me
<erikh> haha
<zzak> does he do backflips?
<erikh> ha, no.
krohrbaugh has quit [Quit: Leaving.]
CodeBlock__ has left #ruby-lang [#ruby-lang]
woollyams has joined #ruby-lang
<zzak> how old?
<erikh> about 8 years.
<zzak> oh, he's an old fart
<erikh> yeah, he's getting up there.
<zzak> at least the winters aren't so bad there
<erikh> well most of his life he lived in oregon and philly
<erikh> and now he's inside all the time
<erikh> winters have pretty much sucked for him universally
<erikh> anyhow, it's 5pm and I need to get away from the computer
<erikh> have a good night.
<zzak> cheers
znowi has quit []
cardoni has quit [Quit: Linkinus - http://linkinus.com]
jtoy has joined #ruby-lang
dpatel has joined #ruby-lang
woollyams has quit [Quit: Computer has gone to sleep.]
woollyams has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
mrsolo has quit [Quit: Leaving]
<zenspider> RAWR
hahuang65 has joined #ruby-lang
<zenspider> fixing one stupid parser bug will get me to 4σ... I'm already at 3σ
<zenspider> stupid rspec fans and their stupid leading periods
* zenspider lights rspec users on fire
<zenspider> stupid stupid
woollyams has quit [Quit: Computer has gone to sleep.]
brianpWins has joined #ruby-lang
<dpatel> if i have a array full of symbols that i want to pass into a function that accepts *keys, how would i convert that array and pass it in as a set of string values?
<zenspider> 758 files to go before I turn around and run it again
<zenspider> dpatel: splat it back...
<zenspider> why strings? symbols are king.
<zenspider> but, map to strings and then splat it
vlad_starkov has quit [Remote host closed the connection]
<dpatel> zenspider: because item.attributes.each_pair |k,v| returns both key,values as strings
<zenspider> I don't see what that has to do with an array of symbols
<dpatel> i'm trying to pass in the array to the hash.except function to filter out specific keys
savage- has quit [Remote host closed the connection]
<erikh> hash.except(*(array_of_syms.map(&:to_s)))
* erikh really disappears now
Tearan has quit [Quit: Sleepy Badger....]
<dpatel> thanks, i'll try it out
nitti has joined #ruby-lang
intellitech-afk has joined #ruby-lang
intellitech-afk has left #ruby-lang ["Leaving"]
<dpatel> that worked beautifully
nitti has quit [Ping timeout: 260 seconds]
adurity has quit [Remote host closed the connection]
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
ddd has quit [Quit: Leaving.]
ddd has joined #ruby-lang
ddd has left #ruby-lang [#ruby-lang]
ddd has joined #ruby-lang
dpatel has quit [Quit: dpatel]
imajes has quit [Excess Flood]
imajes has joined #ruby-lang
jtoy has quit [Quit: jtoy]
konr has joined #ruby-lang
cout is now known as KALP
imajes has quit [Quit: Be Back Soon!]
hahuang65 has quit [Quit: Computer has gone to sleep.]
imajes has joined #ruby-lang
jackhammer2022 has joined #ruby-lang
hramrach has quit [*.net *.split]
Axsuul has quit [*.net *.split]
wmoxam has quit [*.net *.split]
davidbalbert has quit [*.net *.split]
take_cheeze has quit [*.net *.split]
_tca has quit [*.net *.split]
babinho has quit [*.net *.split]
lianj has quit [*.net *.split]
anekos has quit [*.net *.split]
jayne has quit [*.net *.split]
groszek has quit [*.net *.split]
ange has quit [*.net *.split]
hramrach has joined #ruby-lang
babinho has joined #ruby-lang
ange has joined #ruby-lang
lianj has joined #ruby-lang
_tca has joined #ruby-lang
wmoxam has joined #ruby-lang
groszek has joined #ruby-lang
jayne has joined #ruby-lang
take_cheeze has joined #ruby-lang
anekos has joined #ruby-lang
Axsuul has joined #ruby-lang
davidbalbert has joined #ruby-lang
josh^ has quit [Excess Flood]
sepp2k has joined #ruby-lang
jbsan has quit [Quit: jbsan]
josh^ has joined #ruby-lang
<konr> Suppose a ruby gem is wrong. Can I fix it and submit to ruby gems, or there is a long process involved?
jbsan has joined #ruby-lang
dous has quit [Remote host closed the connection]
chimkan_ has joined #ruby-lang
thatdutchguy has quit [Remote host closed the connection]
vesan has quit [Read error: Connection reset by peer]
<ddd> fix, and submit to the homepage url for the gem
<ddd> follow the Source Code link and/or Homepage link just above the Gemfile example line on that gem's page on rubygems
vesan has joined #ruby-lang
A124 has quit [Read error: Connection reset by peer]
chimkan_ has left #ruby-lang [#ruby-lang]
toretore has quit [Quit: Leaving]
ddd has quit [Quit: Leaving.]
ddd has joined #ruby-lang
sush24 has joined #ruby-lang
ddd has left #ruby-lang [#ruby-lang]
ddd has joined #ruby-lang
<ddd> client fixed. forgive the part join
tomzx_ has quit [Ping timeout: 260 seconds]
Bwild has quit [Ping timeout: 246 seconds]
krohrbaugh has joined #ruby-lang
<konr> How can I read and eval the source code of a file in a given path?
sush24 has quit [Quit: This computer has gone to sleep]
<konr> got it!
Bwild has joined #ruby-lang
sn0wb1rd has joined #ruby-lang
swarley has quit [Read error: Operation timed out]
swarley has joined #ruby-lang
CoverSlide has joined #ruby-lang
dorei has quit []
dous has joined #ruby-lang
dous has joined #ruby-lang
dous has quit [Changing host]
voker57_ has quit [Read error: Operation timed out]
CoverSlide has quit [Ping timeout: 252 seconds]
thatdutchguy has joined #ruby-lang
voker57_ has joined #ruby-lang
sush24 has joined #ruby-lang
mistym has quit [Remote host closed the connection]
mistym has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
alvaro_o has quit [Quit: Ex-Chat]
thatdutchguy has quit [Remote host closed the connection]
woollyams has joined #ruby-lang
justinmcp has joined #ruby-lang
jtoy has joined #ruby-lang
ruby-lang040 has joined #ruby-lang
ruby-lang040 has quit [Client Quit]
rubyhelp has joined #ruby-lang
rubyhelp has quit [Client Quit]
conor_reedy has joined #ruby-lang
brianpWins has quit [Ping timeout: 246 seconds]
brianpWins has joined #ruby-lang
seoaqua has quit [Ping timeout: 252 seconds]
cranej has joined #ruby-lang
mistym has quit [Remote host closed the connection]
justinmcp has quit [Ping timeout: 260 seconds]
headius has quit [Quit: headius]
headius has joined #ruby-lang
seoaqua has joined #ruby-lang
conor_reedy_ has joined #ruby-lang
conor_reedy has quit [Ping timeout: 246 seconds]
vlad_starkov has joined #ruby-lang
seoaqua has quit [Ping timeout: 265 seconds]
vlad_starkov has quit [Remote host closed the connection]
ryanlecompte has joined #ruby-lang
ryanf has quit [Ping timeout: 248 seconds]
roadt has joined #ruby-lang
vlad_starkov has joined #ruby-lang
ryanf has joined #ruby-lang
mistym has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
ryanf has quit [Ping timeout: 264 seconds]
ryanf has joined #ruby-lang
WillMarshall has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
justinmcp has joined #ruby-lang
lsegal has joined #ruby-lang
woollyams has quit [Quit: Computer has gone to sleep.]
ryanf has quit [Quit: leaving]
l0st1 has joined #ruby-lang
swarley has quit [Ping timeout: 255 seconds]
woollyams has joined #ruby-lang
krohrbaugh has quit [Quit: Leaving.]
coryf has quit [Remote host closed the connection]
stardiviner has joined #ruby-lang
krohrbaugh has joined #ruby-lang
hahuang65 has joined #ruby-lang
headius has quit [Quit: headius]
burgestrand has quit [Quit: Leaving.]
justinmcp has quit [Ping timeout: 248 seconds]
<erikh> that'll teach you a lot about how classes and modules work in ruby, but honestly, if you can't deal with people using your code in unintended ways, you should probably quit programming.
<Spaceghostc2c> erikh: If I could at least express the intent of the object, I'd quit there.
<erikh> calling instance isn't enough?
<erikh> or viewing the ancestors list?
<Spaceghostc2c> It's not good. The use case is that there should only be one of this object because it has methods that auth against a web api.
<Spaceghostc2c> The web api has a limitation on the number of times the authentication api can be hit each day.
<Spaceghostc2c> So I want one object in the system to hold that auth work and get the key back from the web service.
countdigi has quit [Ping timeout: 245 seconds]
<erikh> I mean, where does this stop? I ran into a guy at a bar the other night who (convincingly) makes a living finding exploits in code that only occur when certain C compilers use certain optimization strategies
imperator has joined #ruby-lang
<Spaceghostc2c> If I'm creating instances and can't refer to the everywhere in the system, I still have an issue.
<Spaceghostc2c> erikh: I guess maybe the problem doesn't get communicated well over IRC. I tried.
<erikh> there's like 6 solutions in that article that meet that sentence, but I suspect after I suggest this you'll have other criteria you haven't mentioned yet
<Spaceghostc2c> If the impending doom of LoginRateExceeded means nothing to you, I don't know if I can really help you understand.
<Spaceghostc2c> erikh: I just need at least a way to communicate "Don't try to subclass me or use me as a mixin"
countdigi has joined #ruby-lang
<Spaceghostc2c> If through normal usage, I can have multiple objects in the system doing what this one single object should do, I've failed to achieve my goal.
<erikh> how about a comment?
<erikh> have you considered a big comment that says "don't do this"?
woollyams has quit [Quit: Computer has gone to sleep.]
<erikh> your code will run faster too
<Spaceghostc2c> Maybe. I personally think that I might use private methods on modules and perhaps check into module_function if it proves useful.
<erikh> private methods can be worked around with #send
<Spaceghostc2c> Either way, ruby's stdlib singleton library sucks.
<Spaceghostc2c> erikh: Yes, but then you know that you're doing bad things.
* erikh blinks
<Spaceghostc2c> I'm talking about typical use cases, like mixins and subclassing.
<Spaceghostc2c> If you're reaching into private methods, I assume you know what the hell you're doing, or God help you.
woollyams has joined #ruby-lang
justinmcp has joined #ruby-lang
<erikh> I simply do not understand why calling send is different than include
<erikh> with foreign code
<Spaceghostc2c> erikh: I suppose that's maybe just a culture difference. :)
<erikh> but really I just don't understand who'd use random bits of code without understanding what they do first
<Spaceghostc2c> So you read through all of rails before using it?
<Spaceghostc2c> Or any ORM, or any library?
<erikh> nope, but I read the docs, that's for sure.
<Spaceghostc2c> I don't call send willynilly. I tend to look at the code if the author went so far as to define the method as private or protected, I'll look at the source.
<erikh> and if the docs say "don't do this", I generally don't, unless I really want to know why and if it makes sense for me.
<Spaceghostc2c> erikh: Yeah, I suppose if this were just an open source app, that'd suffice. It might if I take this chunk of code and open source it.
<erikh> and then I know I've got the gun aimed at my foot
<erikh> ahhh
<Spaceghostc2c> erikh: I'd like a way to programmatically tell them where they're aiming the gun. :)
<Spaceghostc2c> If I could raise an exception or something if they subclass or include/extend, I'd stop there.
<Spaceghostc2c> Otherwise, people will just happily code along. Today, due to our CI and everyone working on a bit of the project, we exhausted our auth limit for the day.
<erikh> well that'll be because of other algorithmic reasons that aren't worth the argument
<Spaceghostc2c> Do you know how pissed management would have been if they heard about it? (They went home for the day.)
<erikh> but, if you have a controlled environment, with documented code, and your programmers know the stack as a part of their job, and they still do this after seeing your comment
<erikh> someone at your job needs to find a new job
<Spaceghostc2c> Tests were using the client every file. One auth per file, a shitton of tests, and 14 dev pairing stations running those tests.
* imperator redefines #send, take that!
<Spaceghostc2c> erikh: I wish it were mine to find.
* erikh aliases imperator's __send__ to send
<Spaceghostc2c> I'm going to look into private and protected method behaviour in modules tomorrow.
* imperator was prepared for such a maneuver and aliased __send__ to "rm -rf /"
<erikh> imperator: but I don't know what rm -rf / does, perhaps I should run it
<imperator> absolutely
<Spaceghostc2c> erikh: Before I was trying to use a local variable or a class level instance variable to hold an anonymous class that had the methods inside it.
<Spaceghostc2c> Which worked brilliantly sorta.
<erikh> if you mean "worked" by "so confusing to teammates they don't know how to instance it", then yes
<imperator> then what, forwarding all the calls to that instance?
<Spaceghostc2c> That's the idea. They shouldn't instantiate it. If they don't understand singletons, they should read the source. I do think that I might make a solid effort to write rdocs for my code.
<Spaceghostc2c> I currently handle most my documentation in git commit messages and assume people are aware of the cooler ways to use git.
<erikh> just so I'm clear
<imperator> private_class_method :new
<erikh> your logic is "if they don't understand my class, by all means use it", but "if by some reason they guess it's a singleton and don't understand what a singleton is, they should read the source"
<erikh> do you see the problem with this argument?
<erikh> just document the thing.
<Spaceghostc2c> I think I will, but I want to stop them from just subclassing or mixing in without thinking.
<Spaceghostc2c> I need something to say, "Whoa there, buddy!"
<Spaceghostc2c> Because the whole point of this thing is to stop multiple auths from happening.
<erikh> you'll save a lot of time, and trust me on this, someone will find a way to break your code no matter how bullet proof you try to make it.
<erikh> so use a spinlock?
<erikh> no need for a singleton.
<Spaceghostc2c> A wat?
<erikh> :)
<erikh> go look it up.
ryanf has joined #ruby-lang
Sambalero has quit [Remote host closed the connection]
* imperator looks it up, too
<Spaceghostc2c> Even if I just have a lifecycle callback to raise a message, I don't mind. It's just that the culture here isn't one that says, "Go read the local docs!"
<Spaceghostc2c> At any damn point.
<Spaceghostc2c> Or even look at the source if you can just mixin/subclass and move on.
<Spaceghostc2c> Maybe it'd be cheaper to make fun of people who don't do that than to try and protect them from themselves.
<imperator> cheaper and, more importantly, funnier
<Spaceghostc2c> It doesn't change much that the singleton is pretty weak in ruby. not a real problem at all.
<Spaceghostc2c> I wonder if I used one from Java if that'd be better/easier. I use jruby a lot.
siyusong has joined #ruby-lang
hahuang65 has quit [Quit: Computer has gone to sleep.]
<erikh> what i'm trying to suggest is that you don't need a singleton in your code
<erikh> at all
<erikh> you need a resource to lock
<erikh> that can be maintained in a number of ways, and largely depends on how your program is architected
<erikh> is it a web program? threaded server? etc?
ahhsm has joined #ruby-lang
<Spaceghostc2c> The project is an ETL tool.
ahhsm has quit [Read error: Connection reset by peer]
dhruvasagar has joined #ruby-lang
<erikh> ok, do you have a common database, filesystem, etc you can rely on to be immediately consistent amongst all programs that would need to check the lock?
nitti has joined #ruby-lang
ryanlecompte has quit [Remote host closed the connection]
<erikh> it does matter really what it is, as long as it immediately reflects state change to all consumers and is globally accessible
<erikh> err, doesn't
<Spaceghostc2c> erikh: I was hoping an object could handle the locking behaviour. If I needed I have infinispan and a couple databases.
<erikh> is it a single ruby process?
<erikh> an object can handle the locking *behavior*
<erikh> it's not the behavior that's as important, it's the notion (at least at this point) that it needs to be a single literal object
<Spaceghostc2c> It's not a thing that only one object can use at one time.
<Spaceghostc2c> I just need one object that handles the auth without people instantiating new ones and having them auth.
<Spaceghostc2c> The goal is to have one object globally available that can auth to the remote api.
<Spaceghostc2c> It probably won't be a single process, no.
<Spaceghostc2c> It'll be across clustered torquebox servers which'll have workers running and the web server per node.
<erikh> and multiple servers authing is no big deal?
<Spaceghostc2c> Nope.
nitti has quit [Ping timeout: 260 seconds]
<Spaceghostc2c> As long as for the lifetime of the server, it uses that one object.
<erikh> that's not really what I asked; if two individual pieces of kit auth at the same time, is it a problem?
<Spaceghostc2c> Nope.
hahuang65 has joined #ruby-lang
<Spaceghostc2c> erikh: One solution is to just toss the auth token I get back after authenticating into my distributed key-value store.
<erikh> I was just going to ask what happens when a second auth is requested
<erikh> but it sounds like you figured it out. :)
<Spaceghostc2c> erikh: I'll test that and see if the same key is returned.
sduckett has quit [Read error: Operation timed out]
<Spaceghostc2c> Maybe in ruby I could use just a global to store the auth key?
<erikh> I mean, that's probably where I'd head with this: class GetMeAnAuthKey gets an auth key from the database, and if that is invalid, requests a new one and stuffs it in the database
seoaqua has joined #ruby-lang
<erikh> (using some kind of preflight predicate)
<Spaceghostc2c> For when I don't have that distributed store?
<Spaceghostc2c> That makes a lot more sense.
<erikh> you could, sure. your could also use the filesystem.
<Spaceghostc2c> erikh: Yeah. Not a bad idea.
<erikh> (which I hope to god is always available)
<erikh> :)
<Spaceghostc2c> Wouldn't work, I'd think, in something like drb (I'm just exploring stupid ideas here, not a requirement)
<erikh> well with drb, you have to consider how portable those auth keys are
<erikh> if you're trying to auth from two different IPs, that could cause trouble
<Spaceghostc2c> erikh: I think it's timestamp based for how relevant they are.
<Spaceghostc2c> Yeah, that's true.
<erikh> there's also a security issue there, as drb doesn't use tls I think
<erikh> well, a potential one
<Spaceghostc2c> erikh: Thank you for being so helpful. I think for my solution, I'll use my infinispan. But for the other project at work, I'll either use a global or load it from the database.
esad has joined #ruby-lang
<Spaceghostc2c> erikh: Oh good point. If I have a secured network though, it's safe?
<drbrain> there's DRb over SSL
<erikh> well, if it's not encrypted and doesn't come from a verified host it's not really secure
<drbrain> err, SSH… DRb over SSL would be easy to add
<Spaceghostc2c> I bought the drb book, worked through it and it didn't sync in.
<erikh> but security is really measured in shades of gray
<Spaceghostc2c> Gotcha. So maybe I'll leave drb out for now.
<Spaceghostc2c> database or really, filesystem maybe.
<erikh> ssh tunneling is probably an option, but probably really not suitable for a high traffic system
krz has joined #ruby-lang
<erikh> (which I assume when you use the term "ETL" that's exactly what you'll be dealing with)
<Spaceghostc2c> erikh: As in Extract Transform Load.
<erikh> right, I guess it depends on how the extract and load happen
<erikh> anyhow, keep it simple, make it more complex later. that's the point.
<erikh> (when you need to, that is)
<Spaceghostc2c> It'll run in the AWS EC2 cloudernets. But there's some webservices that are only available in the work network that'll be ran from inside and sent up to the aforementioned cloudernets.
<Spaceghostc2c> The EC2 stuff will be the ETL project.
<erikh> you shouldn't have a problem on ec2 as long as your security groups are properly configured.
<erikh> (very easy to do)
<erikh> anyhow, yeah, KISS, and conquer.
burgestrand has joined #ruby-lang
<Spaceghostc2c> erikh: Thanks bruv.
ryanlecompte has joined #ruby-lang
conor_reedy_ has quit [Quit: conor_reedy_]
d3vic3 has quit [Ping timeout: 244 seconds]
d3vic3 has joined #ruby-lang
Bwild has quit [Ping timeout: 240 seconds]
Bwild has joined #ruby-lang
CrazyHorse18 has joined #ruby-lang
<CrazyHorse18> hey if i'm an instance of a class
<CrazyHorse18> shouldn't self refer to the class?
<CrazyHorse18> i.e. in the scope of a method
<CrazyHorse18> reason i ask is self.whatever doesn't work… but self.class.whatever does
<drbrain> CrazyHorse18: no
<CrazyHorse18> self refers to the instance?
<drbrain> CrazyHorse18: the instance in an instance method
<CrazyHorse18> ah ok
<CrazyHorse18> so just use self.class instead?
<drbrain> CrazyHorse18: you seem to be calling a class method from an instance method
rippa has joined #ruby-lang
<drbrain> so, yes
<drbrain> CrazyHorse18: can you show your code?
yxhuvud has joined #ruby-lang
<CrazyHorse18> sure
<CrazyHorse18> line 36, 40, 44
<drbrain> line 47 is a class method so you must self.class.
<CrazyHorse18> yeah
<CrazyHorse18> i made it a class method so i didn't have to go
<CrazyHorse18> bla.new when unit testing it
<CrazyHorse18> is that a good practice.. i.e. unless it relys on something on the instance, make it a class method?
replore_ has joined #ruby-lang
<drbrain> no
<drbrain> you should leave it as an instance method
replore_ has quit [Read error: Connection reset by peer]
<CrazyHorse18> what logic do you normally use to split up instance and class methods
<drbrain> it doesn't cost anything to create a new instance
<CrazyHorse18> right
<Spaceghostc2c> drbrain: Really?
<Spaceghostc2c> I thought it inits and allocs a new object onto heap.
<CrazyHorse18> Spaceghostc2c: not for unit tests
<CrazyHorse18> in reality
<drbrain> Spaceghostc2c: it doesn't cost anything worth worrying about
<CrazyHorse18> who cares if you have to load up one obj
<Spaceghostc2c> drbrain: True. :D
<drbrain> CrazyHorse18: also, "#{I18n.t('month')}" is the same as I18n.t('month')
<Spaceghostc2c> CrazyHorse18: Depends on your object! If you do things right, not much.
spinagon has joined #ruby-lang
<drbrain> Spaceghostc2c: it's an ActiveRecord model, it doesn't cost anything worth worrying about
rippa has quit [Read error: Connection reset by peer]
<CrazyHorse18> drbrain: ah yeah, good point.. not my code btw :)
<CrazyHorse18> just fixing it
<drbrain> CrazyHorse18: ok
<CrazyHorse18> had no unit tests
dous has quit [Remote host closed the connection]
<drbrain> CrazyHorse18: the other thing I see here is divmod should be used
<CrazyHorse18> turned a 30 min job into a 3 hour job
<Spaceghostc2c> CrazyHorse18: Refactoring is awesome.
<CrazyHorse18> Spaceghostc2c: yeah it's the number one reason for tests
<drbrain> CrazyHorse18: I spent the last two weeks adding tests to an app so I could have the confidence to add features
<CrazyHorse18> Spaceghostc2c: because you can refactor massive amounts of code so quickly
<CrazyHorse18> drbrain: why should i use divmod instead?
<CrazyHorse18> x.modulo(y) means x-y*(x/y).floor << ahh
<drbrain> CrazyHorse18: it gives both haves at the same time
<drbrain> halves
woollyams has quit [Quit: Computer has gone to sleep.]
CoverSlide has joined #ruby-lang
<drbrain> h, m = t.divmod 3600
<drbrain> well, you can cut off seconds too with a second line
Krists has joined #ruby-lang
yshh has joined #ruby-lang
jackhammer2022 has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
<drbrain> I refactored something like that to this: http://paste.segment7.net/zd.html
ryanlecompte has quit [Remote host closed the connection]
gmci has quit [Quit: Computer has gone to sleep.]
gmci has joined #ruby-lang
vlad_starkov has quit [Remote host closed the connection]
irleif has joined #ruby-lang
brianpWins has joined #ruby-lang
woollyams has joined #ruby-lang
spinagon has quit [Read error: Connection reset by peer]
rippa has joined #ruby-lang
Sambalero has joined #ruby-lang
hakunin has quit [Ping timeout: 246 seconds]
esad has quit [Quit: Computer has gone to sleep.]
nitti has joined #ruby-lang
nitti has quit [Ping timeout: 260 seconds]
siyusong has quit [Quit: Computer has gone to sleep.]
spinagon has joined #ruby-lang
rippa has quit [Read error: Connection reset by peer]
WillMarshall has quit [Quit: Computer has gone to sleep.]
hakunin has joined #ruby-lang
vlad_starkov has joined #ruby-lang
hahuang65 has quit [Quit: Computer has gone to sleep.]
jtoy has quit [Quit: jtoy]
justinmcp has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 244 seconds]
woollyams has quit [Quit: Computer has gone to sleep.]
woollyams has joined #ruby-lang
nyuszika7h has quit [Ping timeout: 246 seconds]
hakunin has quit [Read error: No route to host]
dous has joined #ruby-lang
dous has quit [Changing host]
dous has joined #ruby-lang
cyri_ has joined #ruby-lang
tbuehlmann has joined #ruby-lang
<CrazyHorse18> drbain: thanks.. still working on it.. just finishing of unit tests :)
rippa has joined #ruby-lang
<CrazyHorse18> added about 5 more requirements
hakunin has joined #ruby-lang
spinagon has quit [Read error: Connection reset by peer]
Sambalero has quit [Remote host closed the connection]
cyri_ has quit [Client Quit]
justinmcp has joined #ruby-lang
nyuszika7h has joined #ruby-lang
sepp2k has quit [Remote host closed the connection]
rippa has quit [Ping timeout: 246 seconds]
mytrile has joined #ruby-lang
dr_bob has joined #ruby-lang
esad has joined #ruby-lang
JohnBat26 has joined #ruby-lang
cid404 has quit [Read error: Operation timed out]
roadt has quit [Ping timeout: 255 seconds]
Kero__ is now known as Kero
nofxx has quit [Ping timeout: 256 seconds]
irleif has quit [Quit: Computer has gone to sleep.]
josh^ has quit [Remote host closed the connection]
Carnage\ has joined #ruby-lang
irleif has joined #ruby-lang
ruurd has joined #ruby-lang
solars has joined #ruby-lang
Axsuul has quit [Read error: Connection reset by peer]
Axsuul has joined #ruby-lang
thone_ has joined #ruby-lang
chendo__ has quit [Quit: Computer has gone to sleep.]
Carnage\ has quit []
josh^ has joined #ruby-lang
thone has quit [Ping timeout: 260 seconds]
imperator has left #ruby-lang ["Leaving"]
Assurbanipal has joined #ruby-lang
vlad_starkov has joined #ruby-lang
areil has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 248 seconds]
wallerdev has quit [Quit: wallerdev]
robotmay has joined #ruby-lang
justinmcp has quit [Remote host closed the connection]
gnufied has joined #ruby-lang
workmad3 has joined #ruby-lang
gmci has quit [Quit: Computer has gone to sleep.]
gmci has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 248 seconds]
francisfish has joined #ruby-lang
agile has quit [Ping timeout: 245 seconds]
dhruvasagar has joined #ruby-lang
shame has quit [Ping timeout: 246 seconds]
irleif has quit [Quit: Computer has gone to sleep.]
woollyams has quit [Ping timeout: 244 seconds]
dhruvasagar has quit [Read error: No route to host]
dhruvasagar has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 260 seconds]
dhruvasagar has joined #ruby-lang
judofyr has joined #ruby-lang
ryanf has quit [Quit: leaving]
nitti has joined #ruby-lang
rking has quit [Ping timeout: 248 seconds]
rking has joined #ruby-lang
nitti has quit [Ping timeout: 246 seconds]
neurodamage has quit [Ping timeout: 246 seconds]
neurodamage has joined #ruby-lang
esad has quit [Quit: Computer has gone to sleep.]
krz has quit [Quit: krz]
workmad3 has quit [Quit: Lost terminal]
jxie has quit [Quit: leaving]
runeb has joined #ruby-lang
irleif has joined #ruby-lang
judofyr has quit []
facest has quit [Ping timeout: 252 seconds]
facest has joined #ruby-lang
WillMarshall has joined #ruby-lang
WillMarshall has quit [Client Quit]
justinmcp has joined #ruby-lang
hackeron_ has joined #ruby-lang
woollyams has joined #ruby-lang
jarib has quit [Excess Flood]
irleif has quit [Quit: Computer has gone to sleep.]
jarib has joined #ruby-lang
hackeron has quit [Ping timeout: 260 seconds]
woollyams has quit [Ping timeout: 255 seconds]
hackeron has joined #ruby-lang
hackeron_ has quit [Ping timeout: 252 seconds]
Mon_Ouie has quit [Ping timeout: 245 seconds]
fjfish has joined #ruby-lang
francisfish has quit [Ping timeout: 272 seconds]
heftig has quit [Quit: leaving]
lsegal has quit [Quit: Quit: Quit: Quit: Stack Overflow.]
futurechimp has joined #ruby-lang
gnufied has quit [Quit: Leaving.]
dhruvasagar has quit [Read error: Operation timed out]
dhruvasagar has joined #ruby-lang
vlad_starkov has joined #ruby-lang
gnufied has joined #ruby-lang
vesan has quit [Ping timeout: 272 seconds]
charliesome has joined #ruby-lang
vlad_starkov has quit [Ping timeout: 256 seconds]
jarib has quit [Excess Flood]
vesan has joined #ruby-lang
jarib has joined #ruby-lang
nitti has joined #ruby-lang
jgomez has joined #ruby-lang
justinmcp has quit [Remote host closed the connection]
nitti has quit [Ping timeout: 246 seconds]
workmad3 has joined #ruby-lang
thisirs has joined #ruby-lang
seoaqua has quit [Quit: 离开]
<andrewvos> My pair has just gone off to a quick standup with his team. He's been there for like 20-30 minutes.
<andrewvos> Yay Agile
<andrewvos> How did this happen to agile? It was such a pretty little idea.
<andrewvos> Actually, how did *we* let this happen to agile.
S1kx has joined #ruby-lang
S1kx has quit [Changing host]
S1kx has joined #ruby-lang
jarib has quit [Excess Flood]
nullthreat_ has joined #ruby-lang
chendo__ has joined #ruby-lang
sush24 has joined #ruby-lang
jarib has joined #ruby-lang
nullthreat_ has quit [Client Quit]
chendo__ has quit [Ping timeout: 245 seconds]
sush24 has quit [Client Quit]
<gnufied> why are you not in standup and questioning this?
<andrewvos> gnufied: Different team.
<gnufied> how come he is your pair then?
<gnufied> something complicated I surmise.
<andrewvos> gnufied: I'm on a team that gets injected into other teams to share knowledge etc.
<andrewvos> He is on my team, and this other team.
<gnufied> cool. makes sense. yeah but best to do is question their judgement.
<gnufied> or ask your pair to raise the point during standup. but that does not work sometimes. people take standups as way of collecting status reports and then some folks go on a tangent
<gnufied> s/take/use/
anannie has quit [Remote host closed the connection]
Hakon has quit [Quit: Leaving...]
robotmay has quit [Read error: Connection reset by peer]
<injekt> andrewvos: where are you working now?
robotmay has joined #ruby-lang
<andrewvos> gnufied: It's hard to challenge a Project Managers process though, and dangerous.
<andrewvos> gnufied: I nice way is to tell them to hold a ball, or some object while they talk. Sometimes it speeds people up.
toretore has joined #ruby-lang
cdt has joined #ruby-lang
cranej has quit [Quit: Page closed]
anannie has joined #ruby-lang
nitti has joined #ruby-lang
gmci has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
nitti has quit [Ping timeout: 246 seconds]
areil_ has joined #ruby-lang
areil has quit [Read error: Connection reset by peer]
sush24 has joined #ruby-lang
robotmay has quit [Read error: Connection reset by peer]
robotmay has joined #ruby-lang
yats has joined #ruby-lang
x0F has quit [Disconnected by services]
x0F_ has joined #ruby-lang
x0F_ is now known as x0F
futurechimp has quit [Ping timeout: 245 seconds]
brianpWins_ has joined #ruby-lang
cantonic_ has joined #ruby-lang
yats has quit [Ping timeout: 265 seconds]
brianpWins has quit [Ping timeout: 240 seconds]
cantonic has quit [Ping timeout: 240 seconds]
cantonic_ is now known as cantonic
brianpWins_ is now known as brianpWins
dous has quit [Remote host closed the connection]
runeb has quit [Remote host closed the connection]
runeb has joined #ruby-lang
runeb has quit [Remote host closed the connection]
kiddorails has joined #ruby-lang
runeb has joined #ruby-lang
kiddorails1 has joined #ruby-lang
kiddorails has quit [Ping timeout: 252 seconds]
heftig has joined #ruby-lang
woollyams has joined #ruby-lang
ruurd has quit [Quit: Leaving...]
ruurd has joined #ruby-lang
ruurd has quit [Read error: Connection reset by peer]
ruurd_ has joined #ruby-lang
kiddorails has joined #ruby-lang
kiddorails1 has quit [Ping timeout: 260 seconds]
heftig has quit [Read error: Connection reset by peer]
futurechimp has joined #ruby-lang
heftig has joined #ruby-lang
heftig has quit [Read error: Connection reset by peer]
huugsy has joined #ruby-lang
dous has joined #ruby-lang
dous has quit [Changing host]
dous has joined #ruby-lang
runeb has quit [Remote host closed the connection]
kiddorails has quit [Ping timeout: 268 seconds]
mwjcomputing has joined #ruby-lang
runeb has joined #ruby-lang
robotmay has quit [Ping timeout: 244 seconds]
runeb has quit [Ping timeout: 268 seconds]
robotmay has joined #ruby-lang
yshh has quit [Remote host closed the connection]
kiddorails has joined #ruby-lang
Assurbanipal has quit [Quit: Konversation terminated!]
kiddorails1 has joined #ruby-lang
kiddorails has quit [Ping timeout: 260 seconds]
yats has joined #ruby-lang
heftig has joined #ruby-lang
kiddorails1 has quit [Ping timeout: 240 seconds]
nitti has joined #ruby-lang
runeb has joined #ruby-lang
runeb has quit [Remote host closed the connection]
nitti has quit [Ping timeout: 246 seconds]
charliesome has quit [Quit: Textual IRC Client: www.textualapp.com]
runeb has joined #ruby-lang
threedaymonk has quit [Read error: Operation timed out]
dfanjul has joined #ruby-lang
dfanjul has left #ruby-lang [#ruby-lang]
cdt has quit [Quit: Ex-Chat]
stardiviner has quit [Quit: my website: http://stardiviner.dyndns-blog.com/]
vesan has quit [Read error: Connection reset by peer]
vesan has joined #ruby-lang
<hackeron> I'm looking for something like God or Bluepill where you can specify process dependencies (e.g. start process2 only after the process1 is running) - how do you ensure 1 process is started after another in deployment?
<jMCg> hackeron: SMF, upstart…
stardiviner has joined #ruby-lang
huugsy has quit [Ping timeout: 260 seconds]
<hackeron> jMCg: I have many IP cameras, they are added and removed frequently - for each I need to start a proxy-server a recorder-client and motion-detector but only once the proxy-server is started. God seems ideal because of the ruby DSL and I can get the list of cameras from the database, but it doesn't allow starting the detector after the proxy :( - having hundreds of upstart init configs with some added/removed daily doesn't seem like a good ...
<hackeron> ... solution
<hackeron> maybe I should use something like http://daemons.rubyforge.org and monitor that with god, hmm - but not sure how it would monitor the child processes
carloslopes has joined #ruby-lang
<hackeron> jMCg: bluepill also misses this what seems like really basic functionality :/ - there doesn't seem to be a way to tell bluepill start process B after process A - e.g. start web app after database - it's bizzare there aren't any kinds of process dependencies
<jMCg> hackeron: god has that?
<hackeron> jMCg: nope - monit does but it is a pain to generate monit files and restart monit all the time - would be perfect if it had a ruby dsl :(
<jMCg> upstart doesn't need restarts.
<hackeron> jMCg: but it doesn't monitor the process or restart it if it dies
<jMCg> yes, actually, it does - the latter. But it's hard to tell for upstart if the process is dead, if it didn't die.
<hackeron> jMCg: if it isn't monitoring the process or is aware if it does, how does it auto restart it?
<hackeron> or is aware that it died*
<jMCg> hackeron: it's tracking it with ptrace
<hackeron> jMCg: it only seems to do it if it isn't daemonized, but it's not great
<jMCg> *nod*
bastilian has joined #ruby-lang
<jMCg> That's the easiest way.
<jMCg> I use it for tomcats and httpds and what not.
<hackeron> just seems bizzare to me the developers of god and bluepill didn't take into account that 1 server process may depend on another - e.g. web app depends on the database :/ - is this not really basic stuff?
anannie has quit [Quit: Leaving...]
<hackeron> yeh, upstart is the easiest if you don't need to monitor the process - that's what I use for many things, but in the case of thie IP camera proxy/recorder/detector combination, some times the proxy dies (i.e. ip camera misbehaving) and upstart is not able to detect or do anything about it - maybe I'll just have an external process to check all proxies and if they are misbehaving send a service restart proxy-1 which will stop the recorders ...
<hackeron> ... and detectors and then start all 3 again
<hackeron> but would be nice to have cpu/mem checks and what not and something independent of upstart
<jMCg> So, yeah, that's what monit does, but monit is horrible to configure (automatically)
<hackeron> yeh :(
Axsuul has quit [Ping timeout: 272 seconds]
irleif has joined #ruby-lang
konr has quit [Ping timeout: 260 seconds]
<jMCg> Wasn't there an include thingy for monit?
<chris2> hm, shouldnt be too hard with a runit based setup
<hackeron> I guess bluepill has a start_grace_time, but seems messy
<chris2> figure out the pid, do some psing and then check if cpu time or mem usage got too big?
mistym has quit [Remote host closed the connection]
<jMCg> chris2: that's exactly *not* what hackeron is looking for ;)
<chris2> because?
<darix> chris2: well you could just use ulimits for that. if it ate too much memory/cpu -> killed -> restart by runit ;D
<chris2> darix: good point!
justinmcp has joined #ruby-lang
<chris2> chpst should support that already
<hackeron> chris2: a ruby DSL would really help here, the problem is there are 50 IP cameras, for each I need to fork a proxy process, when that starts, it needs to fork a recorder and detector process - so what, generating 700 init configs and then making sure they are all being monitored and running and deleting/creating them -- with a ruby DSL can just be a single process forking all this
<darix> hackeron: service dependencies especially over multiple machines can be tricky to express.
<hackeron> darix: it's a single machine
<chris2> hm, only memory not cpu time
<chris2> hackeron: one config and 150 symlinks
<hackeron> chris2: with a ruby DSL can just be Cameras.each {|c| god.watch ...} - cleaner than 150 symlinks that need to be kept up to date
<hackeron> chris2: and how would it be 1 config? - each camera has different parameters, addresses, motion detection thresholds, etc - so hundreds of separate configs
<chris2> you can write a dsl to create symlinks if you prefer
<chris2> hackeron: ah, ok
<chris2> hackeron: one service config i mean
<hackeron> chris2: I could, but god and bluepill are really close to doign what I want, except I can't seem to tell them to start the detector process after the proxy process, meh
woollyams has quit [Quit: Computer has gone to sleep.]
<darix> .oO( is it just me or does it smell a bit like overengineering? )o
<hackeron> darix: probably :) - what are your thoughts about this problem?
<chris2> runit has kinda annoying deps too, but they work for me so far
<chris2> does a proxy restart also require restarting the detectors?
<darix> hackeron: i havent thought enough about the problem.
<hackeron> chris2: seems very similar to upstart - but I donno, creating a DSL that will create 700 symlinks and then issue start commands to each and all that seems less clean than maybe modifying god to start the detector process after the proxy process somehow
<darix> hackeron: what i can say is
<darix> you can do some nice things with runit
<hackeron> chris2: the detectors will die if the proxy is stopped, so I guess not, no
<darix> e.g. my run script for rails apps is shared among all apps
<chris2> ok then
<darix> i configure it via the env subdirectory per app
<hackeron> chris2: so maybe I should just use the start_grace_time option in bluepill - but then if the proxy is misbehaving, there is a lot of extra failures and restarts of the other processes when really it should wait for the proxy to restart first
conorreedy has joined #ruby-lang
<hackeron> darix: hmmm, I've never played with runit - how is it different to upstart?
<darix> hackeron: i run runit parallel to my sysvinit
<darix> and havent played much with upstart
<chris2> hackeron: in essence, it takes a dir of run scripts, and restarts them if they exit
dhruvasagar has quit [Ping timeout: 268 seconds]
<hackeron> darix: seems very similar from what I can tell - I am considering upstart as that deals with process dependencies and auto restarting and things like that
<darix> hackeron: e.g. adding/removing a service is just copying the dir with the run script into the directory that is watched by runit
<darix> which is quite nice
mwjcomputing has quit [Quit: Leaving]
dhruvasagar has joined #ruby-lang
<darix> hackeron: i would say ... play around with it
<hackeron> darix: does it stop a process if you remove a directory or change it?
<chris2> yes
<darix> removing yes. changing requires sv restart
znake has joined #ruby-lang
<chris2> darix: not if you change the inode
<chris2> (use symlinks)
<darix> chris2: well... i usually changed files in the env dir or so
<darix> then i needed sv restart
<darix> which isnt all that much work :)
<chris2> darix: and the envdir stuff is from daemontools, no?
<darix> uhm
<darix> not sure it is specific to them.
<hackeron> darix: hmm interesting - in upstart you create a /etc/init/process.conf - which tells upstart how to start/stop, when to give up, how many times to retry, etc and you specify events like start_on started proxy_1 - so then when you do start proxy_1 it will automatically start the other config -- this is all nice, but not very dynamic
<chris2> its not included in runit
<darix> chris2: sure is :p
<darix> from my rails start script
<darix> RAILS_ROOT="$(<env/RAILS_ROOT)"
<darix> exec chpst -u lighttpd -e ./env ${RAILS_ROOT}/script/unicorn -c ${RAILS_ROOT}/config/unicorn.rb 2>&1
<chris2> oh, chpst -e
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
conor_reedy has joined #ruby-lang
cantonic_ has joined #ruby-lang
heftig has quit [Quit: leaving]
conor_reedy_ has joined #ruby-lang
conor_reedy has quit [Read error: Connection reset by peer]
<gnufied> interesting never heard of chpst
<darix> gnufied: you are welcome! :D
cantonic has quit [Ping timeout: 252 seconds]
cantonic_ is now known as cantonic
<hackeron> darix: chris2: What I really wish is to be able to do something like this instead of dealing with environments and hundreds of synlinks or directories and manually managing files: http://pastie.org/5072990
<darix> then do that:)
<hackeron> darix: I want to but unfortunately neither bluepill or god doesn't have a depends option :( - so I'm looking for something similar that does :P
<hackeron> neither bluepill or god have a dpeends option*
conor_reedy_ has quit [Quit: conor_reedy_]
<darix> so extend them to have such feature?:p
<hackeron> yeh, might have to - just seems weird to me that such basic functionality like "start rails app after the database" is not possible with god and bluepill :
wmoxam has quit [Quit: leaving]
<hackeron> :/
<chris2> gnufied: chpst is just the dozen daemontool utils in one binary :)
wmoxam has joined #ruby-lang
justinmcp has quit [Remote host closed the connection]
<chris2> bougyman: query?
<bougyman> chris2: sure thing
<darix> hey bougyman
<bougyman> chpst replaces all the silly daemontools scripts in one tidy package.
<darix> bougyman: did you see the link from a few days ago?:D
<bougyman> darix: which?
<bougyman> yeah.
cdt has joined #ruby-lang
VGoff is now known as VGoff_afk
<darix> ok^^
<bougyman> great to see more people embracing runit.
<bougyman> it's really popular in the cloud space.. who'd have thunk it.
conor_reedy has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 260 seconds]
<bougyman> chris2: have you tried sv-helper? it's in the aur. just adds wrappers. makes it easy for our support people to use runit without a learning curve.
<darix> bougyman: sv-helper?
<bougyman> svls, sv-stop, sv-start, sv-list, sv-enable, sv-disable, a few others.
<bougyman> it's just a small bash script
<darix> hm
dhruvasagar has joined #ruby-lang
<darix> bougyman: should i put them into my package too?
<bougyman> darix: i keep it as a separate package from runit
<bougyman> was thinking about adding it, but i'd rather have an ok from Pape before doing that.
<darix> bougyman: well i can do it in a subpackge too
<darix> i would just package it from the normal runit.spec :)
Hakon has joined #ruby-lang
kuja has quit [Ping timeout: 260 seconds]
havenn has quit [Remote host closed the connection]
kuja has joined #ruby-lang
conor_reedy has quit [Quit: conor_reedy]
sailias has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
wyhaines has joined #ruby-lang
malev has joined #ruby-lang
mistym has quit [Remote host closed the connection]
nitti has joined #ruby-lang
erichmenge has joined #ruby-lang
imperator has joined #ruby-lang
havenn has joined #ruby-lang
znake has quit [Quit: znake]
postmodern has quit [Quit: Leaving]
malev has quit [Remote host closed the connection]
<imperator> FYI test-unit 2 does NOT wrap minitest; whatshisface was showing me the wrong repo
voker57__ has joined #ruby-lang
Hakon has quit [Quit: Leaving...]
voker57_ has quit [Ping timeout: 245 seconds]
wallerdev has joined #ruby-lang
cdt has quit [Quit: Ex-Chat]
cdt has joined #ruby-lang
kiddorails has joined #ruby-lang
heftig has joined #ruby-lang
<zzak> there's a TU compatibility wrapper for minitest in stdlib now
<zzak> maybe thats what you're thinking of
<imperator> yeah
<zzak> TU2 is still a gem tho
<imperator> yep
<zzak> btw, good morning!
lcdhoffman has joined #ruby-lang
<imperator> good morning
sduckett has joined #ruby-lang
nyuszika7h has quit [Changing host]
nyuszika7h has joined #ruby-lang
Serial_Killer_C has joined #ruby-lang
gsav has joined #ruby-lang
gsav_ has joined #ruby-lang
gsav has quit [Client Quit]
guns has joined #ruby-lang
ferdinandsvehla has joined #ruby-lang
seydar has joined #ruby-lang
<seydar> _Mon_Ouie_: pingaling
agile has joined #ruby-lang
dhruvasagar has quit [Ping timeout: 256 seconds]
<seydar> _Mon_Ouie_: regarding coolline, there's a bug where typed characters aren't displayed when using a multiline prompt. i suspect it has to do with the ansi_length being miscalculated
<seydar> testing out a fix now
malev has joined #ruby-lang
ferdinandsvehla has quit [Read error: Connection reset by peer]
erichmenge has quit [Quit: Be back later]
dhruvasagar has joined #ruby-lang
thisirs has quit [Remote host closed the connection]
slaytanic has joined #ruby-lang
malev has quit [Ping timeout: 252 seconds]
malev has joined #ruby-lang
futurechimp has quit [Ping timeout: 268 seconds]
Sambalero has joined #ruby-lang
malev has quit [Ping timeout: 245 seconds]
futurechimp has joined #ruby-lang
burgestrand has quit [Quit: Leaving.]
<seydar> _Mon_Ouie_: k, fixed it. had to readjust #render and #readline
malev has joined #ruby-lang
sush24 has quit [Quit: This computer has gone to sleep]
replore has joined #ruby-lang
<seydar> _Mon_Ouie_: http://hpaste.org/76407
malev has quit [Ping timeout: 248 seconds]
malev has joined #ruby-lang
sush24 has joined #ruby-lang
malev has quit [Ping timeout: 246 seconds]
malev has joined #ruby-lang
coryf has joined #ruby-lang
Krists has quit [Read error: Connection reset by peer]
rippa has joined #ruby-lang
Serial_Killer_C has quit [Remote host closed the connection]
Serial_Killer_C has joined #ruby-lang
Sambalero has quit [Remote host closed the connection]
imperator has quit [Quit: Leaving]
krohrbaugh has quit [Quit: Leaving.]
Hakon has joined #ruby-lang
yats has quit [Ping timeout: 252 seconds]
futurechimp has quit [Ping timeout: 245 seconds]
solars has quit [Ping timeout: 260 seconds]
yats has joined #ruby-lang
take_cheeze has quit [Quit: Leaving.]
take_cheeze has joined #ruby-lang
seydar has quit [Quit: leaving]
enebo has joined #ruby-lang
Hakon has quit [Quit: Leaving...]
dhruvasagar has quit [Read error: Operation timed out]
Serial_Killer_C has quit [Remote host closed the connection]
areil_ has left #ruby-lang [#ruby-lang]
yats has quit [Ping timeout: 252 seconds]
areil has joined #ruby-lang
Serial_Killer_C has joined #ruby-lang
yats has joined #ruby-lang
tos9 has quit [Ping timeout: 256 seconds]
yats has quit [Ping timeout: 260 seconds]
anannie has joined #ruby-lang
dRbiG has joined #ruby-lang
mytrile has quit [Remote host closed the connection]
futurechimp has joined #ruby-lang
macmartine has joined #ruby-lang
yats has joined #ruby-lang
jxie has joined #ruby-lang
bastilian has quit [Quit: Leaving...]
Sambalero has joined #ruby-lang
futurechimp has quit [Ping timeout: 260 seconds]
stiang has joined #ruby-lang
slyphon has joined #ruby-lang
futurechimp has joined #ruby-lang
blazes816 has joined #ruby-lang
kiddorails has quit [Read error: Connection reset by peer]
kiddorails1 has joined #ruby-lang
kiddorails1 has quit [Client Quit]
kiddorails has joined #ruby-lang
yats has quit [Ping timeout: 246 seconds]
yats has joined #ruby-lang
headius has joined #ruby-lang
nitti has quit [Remote host closed the connection]
Assurbanipal has joined #ruby-lang
scampbell has joined #ruby-lang
brianpWins has quit [Quit: brianpWins]
krohrbaugh has joined #ruby-lang
stardiviner has quit [Quit: my website: http://stardiviner.dyndns-blog.com/]
yats has quit [Ping timeout: 248 seconds]
ryanlecompte has joined #ruby-lang
aoberoi has joined #ruby-lang
<aoberoi> i have a question related to gem development
<aoberoi> so i want to include logging via the Logger class into my gem, but I only want log statements to be output if the application which includes my gem is being run in development
<aoberoi> there is the Logger.severity api
roadt has joined #ruby-lang
<aoberoi> but how do i set the severity property according to the application that is including my gem?
fjfish has quit [Ping timeout: 272 seconds]
<aoberoi> is there a standard way of passing information about whether this is a development environment or production into required gems?
<zzak> env?
<aoberoi> so my gem should be checking ENV[env] == 'development'?
<zzak> rails has Rails.env, which i think uses RACK_ENV, same with sinatra
<zzak> but it depends on what you're trying to support
<aoberoi> not a rack nor rails application though
<zzak> yeh
erichmenge has joined #ruby-lang
<zzak> what are you supporting?
guns has quit [Quit: guns]
<aoberoi> in general, when you add development_dependencies to a gem, is it possible at runtime to know if the gem was installed with bundle install --dev?
dr_bob has quit [Quit: Leaving.]
<zzak> sounds like a #bundler question, tbh
<andrewvos> That sounds evil.
<aoberoi> well my gem makes some API calls over HTTP, i want to be able to log responses from the API server
sn0wb1rd has quit [Quit: sn0wb1rd]
<aoberoi> but the gem is already in the wild, so i want to add logging code to the repo that only gets "turned on" when someone who is specifically debugging the gem is using it
<zzak> what does it do?
<aoberoi> the gem?
<aoberoi> its 'opentok'
yats has joined #ruby-lang
<aoberoi> it is intended to be used in a rails or rack application, but it shouldn't be limited to that
<aoberoi> and the gem certainly shouldn't have to depend on that
ddd has quit [Quit: Leaving.]
<zzak> there is the -d flag
<zzak> for $DEBUG
<zzak> ie: ruby -d myapp.rb
gnufied has quit [Quit: Leaving.]
<aoberoi> oh interesting
tenderlove has joined #ruby-lang
<zzak> not sure how that affects your ENV tho
<zzak> like, rails something -d
<zzak> idk what that does
yats has quit [Quit: Leaving]
yats has joined #ruby-lang
heftig has quit [Quit: leaving]
sn0wb1rd has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
spastorino has joined #ruby-lang
siyusong has joined #ruby-lang
spastorino has left #ruby-lang [#ruby-lang]
stiang has quit [Quit: stiang]
<zzak> looks like rails has the -u for debugger, which uses Debugger.start
spastorino has joined #ruby-lang
<zzak> but im curious if the debugger gem modifies $DEBUG or not
thatdutchguy has joined #ruby-lang
<aoberoi> so i could just use an instance of Logger and set severity to Logger::DEBUG if $DEBUG and to Logger::FATAL
<zzak> yeh, i would honestly worry a bit about rails tho
<zzak> you say it could be used with anything, but mostly likely thats going to be rails
<zzak> that should get you started tho
Assurbanipal has quit [Quit: Konversation terminated!]
heftig has joined #ruby-lang
ddd has joined #ruby-lang
runeb has quit [Remote host closed the connection]
yats has quit [Ping timeout: 240 seconds]
kiddorails has quit [Ping timeout: 246 seconds]
carloslopes has quit [Quit: Leaving.]
spastorino has quit [Quit: spastorino]
Serial_Killer_C has quit [Remote host closed the connection]
<aoberoi> thanks zzak
macmartine has quit [Quit: Computer has gone to sleep.]
Serial_Killer_C has joined #ruby-lang
bfreeman has joined #ruby-lang
irleif has quit [Quit: Computer has gone to sleep.]
francisfish has joined #ruby-lang
JohnBat26 has quit [Ping timeout: 252 seconds]
brianpWins has joined #ruby-lang
jtoy has joined #ruby-lang
aoberoi has quit [Remote host closed the connection]
kiddorails has joined #ruby-lang
irleif has joined #ruby-lang
irleif has quit [Client Quit]
jgomez has quit [Quit: Leaving]
alvaro_o has joined #ruby-lang
kiddorails has quit [Ping timeout: 260 seconds]
ryanlecompte has quit [Read error: Connection reset by peer]
ryanlecompte has joined #ruby-lang
mwjcomputing has joined #ruby-lang
runeb has joined #ruby-lang
areil has quit [Remote host closed the connection]
havenn has quit [Remote host closed the connection]
dpatel has joined #ruby-lang
runeb has quit [Ping timeout: 264 seconds]
cirenyc has joined #ruby-lang
cdt has quit [Quit: Ex-Chat]
mrsolo has joined #ruby-lang
futurechimp has quit [Quit: Leaving]
carloslopes has joined #ruby-lang
hahuang65 has joined #ruby-lang
irleif has joined #ruby-lang
sush24 has quit [Quit: Leaving]
enebo has quit [Quit: enebo]
sush24 has joined #ruby-lang
d3vic3 has quit [Quit: leaving]
irleif has quit [Client Quit]
gmci has joined #ruby-lang
d3vic3 has joined #ruby-lang
thatdutchguy has quit [Remote host closed the connection]
miah has joined #ruby-lang
robotmay_ has joined #ruby-lang
nitti has joined #ruby-lang
yats has joined #ruby-lang
hahuang65 has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
robotmay has quit [Ping timeout: 246 seconds]
acyed has joined #ruby-lang
havenn has joined #ruby-lang
rolfb has joined #ruby-lang
justinram has joined #ruby-lang
KALP is now known as cout
havenn has quit [Ping timeout: 256 seconds]
ruurd_ has quit [Quit: Leaving...]
yats has quit [Ping timeout: 246 seconds]
kain has joined #ruby-lang
cardoni has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has quit [Changing host]
nofxx has joined #ruby-lang
benanne has joined #ruby-lang
irleif has joined #ruby-lang
cirenyc has quit [Quit: Leaving...]
siyusong has quit [Quit: Computer has gone to sleep.]
benanne has quit [Ping timeout: 245 seconds]
alexkira has quit []
esad has joined #ruby-lang
siyusong has joined #ruby-lang
havenn has joined #ruby-lang
Krists has joined #ruby-lang
Krists has quit [Client Quit]
irleif has quit [Quit: Computer has gone to sleep.]
esad has quit [Client Quit]
enebo has joined #ruby-lang
irleif has joined #ruby-lang
havenn has quit [Ping timeout: 260 seconds]
nitti has quit [Remote host closed the connection]
brianpWins has quit [Quit: brianpWins]
nitti has joined #ruby-lang
benanne has joined #ruby-lang
nitti has quit [Ping timeout: 255 seconds]
Hakon has joined #ruby-lang
sush24 has quit [Ping timeout: 245 seconds]
havenn has joined #ruby-lang
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
nitti has joined #ruby-lang
Kero has quit [Quit: brb]
tentimes has joined #ruby-lang
ruurd has joined #ruby-lang
cyri_ has joined #ruby-lang
roadt has quit [Ping timeout: 246 seconds]
Tearan has joined #ruby-lang
anannie has quit [Remote host closed the connection]
Tearan has quit [Quit: Sleepy Badger....]
mwjcomputing has quit [Quit: Leaving]
cardoni has quit [Quit: cardoni]
siyusong has quit [Quit: Computer has gone to sleep.]
HikkiJP has joined #ruby-lang
AltGrendel has joined #ruby-lang
imajes has quit [Excess Flood]
Tearan has joined #ruby-lang
havenn has quit [Remote host closed the connection]
AltGrendel has quit [Client Quit]
imajes has joined #ruby-lang
rindolf has joined #ruby-lang
<rindolf> Hi all.
tos9 has joined #ruby-lang
havenn has joined #ruby-lang
havenn has quit [Remote host closed the connection]
havenn has joined #ruby-lang
Serial_Killer_C has quit [Remote host closed the connection]
cardoni has joined #ruby-lang
Serial_Killer_C has joined #ruby-lang
irleif has quit [Quit: Computer has gone to sleep.]
jtoy has quit [Quit: jtoy]
tenderlove has quit [Remote host closed the connection]
nitti has quit [Remote host closed the connection]
skipper has joined #ruby-lang
nitti has joined #ruby-lang
skipper has quit [Read error: Operation timed out]
nitti has quit [Ping timeout: 252 seconds]
malev has quit [Ping timeout: 256 seconds]
pyrotechnick has joined #ruby-lang
lcdhoffman has quit [Quit: lcdhoffman]
<pyrotechnick> what do you guys think of wycats?
irleif has joined #ruby-lang
tentimes has quit [Quit: Easy as 3.14159265358979323846...]
<blazes816> not a flame-baity topic at all
runeb has joined #ruby-lang
<ddd> detect_troll(pyrotechnick)
pyrotechnick has left #ruby-lang [#ruby-lang]
runeb has quit [Ping timeout: 248 seconds]
gix has quit [Ping timeout: 248 seconds]
imperator has joined #ruby-lang
replore has quit [Remote host closed the connection]
gix has joined #ruby-lang
<erikh> he's a big fat liar. I mean, he's not a cat at all, he's a human
<chris2> :D
<imperator> meow, i mean, uh, hi
__butch__ has joined #ruby-lang
<wycats> hilarious ;)
<chris2> wycats: so what do you think of yourself? :P
<wycats> I'm kind of a dick sometimes
<wycats> amirite
coryf_ has joined #ruby-lang
coryf_ has quit [Read error: Connection reset by peer]
coryf has quit [Read error: Connection reset by peer]
coryf has joined #ruby-lang
<ddd> wycats: oh yeah, such a dick to say your opinion. how dare you not be a drone!
<wycats> ddd: I have no problem with node
<wycats> I was giving ry the benefit of the doubt that he was joking
<wycats> :P
<ddd> even if you did so what
<wycats> although something tells me he was not
<wycats> ddd: confirm
<wycats> ddd: in this case, though, I did not
<ddd> confirmed :)
cirenyc has joined #ruby-lang
cirenyc has quit [Remote host closed the connection]
<ddd> ehh DHH is emphatic about his. why not others :) So Say We All
havenn has quit [Remote host closed the connection]
<imperator> i must have missed something
<ddd> imperator: naa, detect_troll(pyrotechnick) moving on
jamjam has joined #ruby-lang
<wycats> imperator: ry tweeted that we should euthanize Ruby
<wycats> I replied ;)
<wycats> "funny, that's how I feel about Node"
<wycats> :P
wyhaines has quit [Remote host closed the connection]
<ddd> caused a 3-channel trolling. love how fast they pounce too.
Tearan has quit [Quit: Sleepy Badger....]
<blazes816> more than 3
<blazes816> #ruby, #rubyonrails, #rails, #ruby-lang, and #node.js - at least. someone needs a hobby
<ddd> ahh. i'm only in 3 of them then.
<ddd> hehe true that
francisfish has quit [Ping timeout: 246 seconds]
<imperator> euthanize ruby? where'd that come from?
<ddd> he apparently only like c, c++, and one or two others. all others should be eradicated
lcdhoffman has joined #ruby-lang
<chris2> he must have changed lots since i last saw him
Axsuul has joined #ruby-lang
<imperator> yes, eradicated! wait, uh, how do you eradicate a programming language?
<chris2> did that ever work?
<imperator> dammit everyone, stop programming in those languages i don't like!
francisfish has joined #ruby-lang
<ddd> hehe
* imperator downloads node.js
<chris2> ah, the days i was satisfied with sh and awk :P
<wycats> imperator: I'm more confused about how you euthanize a language
warreng has joined #ruby-lang
<imperator> you use a dependency injection
<imperator> THANKS FOLKS, I'M HERE ALL WEEK
<wycats> hahahahahaha
<chris2> rofl
<warreng> i have a ruby string representing a PNG file (starting with "\x89PNG\r\n") but when i try to File.open('/tmp/f.png', 'w') { |f| f.write(str) } i'm getting: Encoding::UndefinedConversionError: "\x89" from ASCII-8BIT to UTF-8
<warreng> perhaps i need to unpack/pack ??
<chris2> open 'wb'
irleif has quit [Quit: Computer has gone to sleep.]
rolfb has quit [Quit: Linkinus - http://linkinus.com]
irleif has joined #ruby-lang
HikkiJP has quit [Ping timeout: 265 seconds]
<warreng> src.encoding.name == "ASCII-8BIT"
nlpplz has quit [Ping timeout: 252 seconds]
<chris2> the problem is the encoding of f
burgestrand has joined #ruby-lang
<warreng> File.open('/tmp/out', 'w:binary') { |f| f.write(src) }
<warreng> that seems to work
<warreng> is that right?
<chris2> 'wb' is shorter
<chris2> but yes
<warreng> ahh boom
<warreng> sweet, thanks
gix has quit [Ping timeout: 255 seconds]
ridders24 has joined #ruby-lang
irleif has quit [Client Quit]
<ridders24> hi all
<ridders24> does anyone know how to export a public twitter page with all its content including replies ?
<ridders24> using ruby
gix has joined #ruby-lang
mytrile has joined #ruby-lang
mrsolo has quit [Quit: This computer has gone to sleep]
nitti has joined #ruby-lang
vlad_starkov has joined #ruby-lang
mrsolo has joined #ruby-lang
Weems has joined #ruby-lang
Weems has quit [Changing host]
Weems has joined #ruby-lang
yaroslav has joined #ruby-lang
codewrangler has joined #ruby-lang
tos9 has quit [Quit: leaving]
Hakon has quit [Quit: Leaving...]
<ridders24> anyone?
<rindolf> ridders24: did you try using the Twitter APIs?
rippa has quit [Ping timeout: 244 seconds]
jtoy has joined #ruby-lang
nlpplz has joined #ruby-lang
solars has joined #ruby-lang
<ridders24> rindolf: yh the twitter API does a export of a profile, but excludes any replies, the only way to get any form of replies to do a extract of a specific tweet ID, but then its out of context and isnt included the the main time line
<chris2> didnt know #4, #6-#9, #14, #23, #46, #50, #67 is questionable, #71, #82/uuid, #94, #98
jbwiv has joined #ruby-lang
tos9 has joined #ruby-lang
yaroslav has quit [Quit: yaroslav]
<rindolf> chris2: are there a 100 things?
<chris2> yes
<chris2> 101
<chris2> but worth it
nitti has quit [Remote host closed the connection]
intellitech has joined #ruby-lang
Carnage\ has joined #ruby-lang
nitti has joined #ruby-lang
irleif has joined #ruby-lang
<rindolf> Wow, it's a large PDF.
gmci has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
wyhaines has joined #ruby-lang
intellitech is now known as intellitech-afk
burgestrand1 has joined #ruby-lang
wyhaines has quit [Read error: Connection reset by peer]
<zzak> youd think someone could easily rifle through SO and grab the top 100 or so answers under #ruby for their talk
<zzak> but i know JEG2 is way better than that
wyhaines has joined #ruby-lang
nitti has quit [Ping timeout: 246 seconds]
burgestrand has quit [Ping timeout: 260 seconds]
sailias has quit [Quit: Leaving.]
nitti has joined #ruby-lang
Kingy has joined #ruby-lang
brianpWins has joined #ruby-lang
brianpWins has quit [Client Quit]
carloslopes has quit [Quit: Leaving.]
cyri_ has quit [Quit: cyri_]
<mistym> ridders24: You said the other day you were having trouble with replies, what's not working for you?
ryanf has joined #ruby-lang
rindolf has quit [Quit: Yay! I'm a llama again. http://www.shlomifish.org/]
Assurbanipal has joined #ruby-lang
<ridders24> mistym: the url you gave me was nice, and I looked into that further, and managed to export a twitter profile, however I noticed that it does not include in the timeline any replies from other users, only tweets from the owner of the profile page
<mistym> ridders24: Ah, but did you look at the metadata included in the tweets you retrieved?
<ridders24> yh it provides the tweet ID, where i could then go into that a then export the replies from that. But Im after somthing that exports it all in once go in the same timeline
<ridders24> not seperated
wyhaines has quit [Ping timeout: 260 seconds]
<mistym> Sure, but couldn't you just insert them into your timeline where you want them?
mytrile has quit [Quit: Leaving.]
<ridders24> I dont really want to have to do that if there over 300 tweets and a good portion of them have conversations attached that i need to paste manually into the main timeline
<ridders24> its bad enough trying to read through the export lol
warreng has left #ruby-lang [#ruby-lang]
<ridders24> any other ideas?
schroedinbug has quit [Ping timeout: 260 seconds]
imperator has quit [Ping timeout: 264 seconds]
<mistym> tbh, looking online, I'm surprised that "get all replies to this tweet" isn't as trivial as I would have expected.
anannie has joined #ruby-lang
imperator has joined #ruby-lang
<anannie> In the for loop ; for array_element in array; {some operations}; end is it possible to get the position of the current value of array_element within the array using some in built function?
slyphon has quit [Quit: WeeChat 0.3.8]
Kingy has quit [Quit: Leaving]
<ridders24> mistym: well it just seems odd that they provide the option to include retweets, which seems useless, but not replies.
lcdhoffman has quit [Quit: lcdhoffman]
Sambalero has quit [Remote host closed the connection]
<_tca> anannie: array.each_with_index {|value, index| puts index }
<mistym> ridders24: The Twitter API is a riddle wrapped in a mystery inside an enigma.
<anannie> yes I've read about that technique _tca, is there anything that works with the for loop? Don't each and for have slight difference?
imperator has quit [Quit: Leaving]
<ridders24> mistym: I like that
<anannie> I want to be able to access the value of the variable outside the code block
alexkira has joined #ruby-lang
schroedinbug has joined #ruby-lang
<_tca> anannie: that doesn't make sense
<_tca> and yes, they work the same
<mistym> _tca: Slight difference in variable scope. The variable you declare in "for i" continues to exist after the termination of the loop.
<anannie> _tca: in x.each { |y| } you can't access the value of y outside the code block once it has finished. Whereas in for y in x you can access it outside the code block once the thing has finished looping
<mistym> anannie: Why do you need to access the value of the variable? There's probably another way of doing it that's a bit cleaner than relying on that.
<_tca> you can access the last iteration?
<anannie> mistym: I'm building a simple blackjack game, this is a nice little benefit of getting the last card served
<_tca> regardless it doesn't make sense
mytrile has joined #ruby-lang
<anannie> * this has a nice little benefit of getting me the last card served
<anannie> mistym: Sorry dyslexia
<_tca> that's not a benefit it's bad programming
<zenspider> agreed
<anannie> _tca: why?
<anannie> I'm new to the gig so I'm sorry that I can't see something that's obvious, but why is it bad programming?
<_tca> not only relying on unintuitive behavior but also mutation, with no savings
<anannie> what does that mean?
<mistym> anannie: You have an easy way to get the last item in the array already: just do cards.last (or whatever the name of your variable is). Relying on odd behaviour to get that could cause you unexpected issues down the line.
<_tca> it means you are relying on unintuitive "magic" that isn't in your code
irleif has quit [Quit: Computer has gone to sleep.]
<mistym> Let's say you do for card in cards; (code goes here); end. But what if you'd already assigned "card" elsewhere? With a cards.each {|card| ...} construction, you keep your original variable. With `for`, you lost it.
<anannie> mistym, _tca that makes sense I'll change it to each
scampbell has quit [Remote host closed the connection]
yxhuvud has quit [Ping timeout: 260 seconds]
<_tca> i've been using ruby for 5 years now and didn't know it did that, but i never use "for x in xs" anyway
<mistym> _tca: new to me too, yeah. It's weird.
<mistym> anannie: cards.each_with_index {|card, index| ...}
<anannie> _tca: I'm just trying to learn bits of the language and figure out the strange things it does. It's like exploration for me in a way
<mistym> anannie: Battle not with monsters, lest ye become a monster ;)
<zenspider> chris2: that's a great link. thanks!
<mistym> Finding the quirks in the language is good, trying to harness them is dangerous
tos9 has quit [Quit: leaving]
<anannie> mistym: I thought that was what good programming was about
<_tca> there's good quirks and bad ones
<_tca> this one is universally bad
Tearan has joined #ruby-lang
<anannie> how do you differentiate between the two _tca?
burgestrand1 is now known as burgestrand
<mistym> You want to be able to understand your code when you look at it again a month later. ;)
Mon_Ouie has quit [Ping timeout: 260 seconds]
My_Hearing has joined #ruby-lang
<anannie> mistym: Oh.
<zenspider> nothing is universally bad... except perl
<erikh> must admit this surprised the shit out of me
HikkiJP has joined #ruby-lang
<erikh> * is non-greedy for the purposes of split?
<anannie> On a related note does anyone know of a project that allows ruby to run on the Lego NXT system? I found this; http://rubotz.rubyforge.org but it isn't in active development and its only partially complete
<anannie> The rest are based on bluetooth based control of the machine from a computer which is undesirable. I'm searching for something like RAD for Lego
Assurbanipal has quit [Quit: Konversation terminated!]
<mistym> anannie: Using the lesser known, but powerful, parts of a language is great! Definitely do that. But if behaviour is surprising, shocking, and/or overly mysterious, then it becomes very hard to debug. After all even when you're actively working on it you may not be sure what it's doing, and after the fact you'll be scratching your head trying to remember what it's meant to do.
justinmcp has joined #ruby-lang
<zenspider> erikh: it's the same as split(//)
<anannie> mistym: Okay I'll follow this from now on
<zzak> erikh: http://ruby-doc.org/core-2.0/Regexp.html see repitition
<erikh> weird. is that an exception?
<erikh> zzak: I know what a kleene star is
<zenspider> no... \s won't match any of the chars
<zenspider> but since you kleene'd it, you match zero length, just like //
<erikh> because it's non-greedy
<zenspider> no, because \s is whitespace and there is none
<erikh> sorry
<erikh> I should have presented a better example
<erikh> irb(main):001:0> "this string".split(/\s*/)
spuk_ has quit [Ping timeout: 260 seconds]
<erikh> => ["t", "h", "i", "s", "s", "t", "r", "i", "n", "g"]
<matled> > "string".split(/.*/) => []
<zenspider> that's the same example... so...
Kingy has joined #ruby-lang
<erikh> there's a space in that string.
<matled> and \s* eats it up greedily
<andrewvos> Hello.
<erikh> oh ha.
<erikh> I'll crawl back into my corner now
<zenspider> yes, there is a space. but you aren't doing =~ on it
<zenspider> this is more like StringScanner
<erikh> right, all made sense when I realized that it's always succeding
<erikh> I'm le tired
tonni has quit [Remote host closed the connection]
tonni has joined #ruby-lang
HikkiJP has quit [Ping timeout: 256 seconds]
VGoff_afk is now known as VGoff
conorreedy has quit [Quit: conorreedy]
runeb has joined #ruby-lang
<zzak> i only know that because the docs used to use "fist" instead of "first" and i had patched it
<andrewvos> haha fist
<chris2> whoa, thanks for remembering me
runeb has quit [Ping timeout: 240 seconds]
brianpWins has joined #ruby-lang
dfanjul has joined #ruby-lang
erichmenge has quit [Quit: Be back later]
<tdy> anyone mind taking a look at this snippet to see if there's a cleaner way?
dfanjul has quit [Client Quit]
<tdy> to get that final ary3 result given ary1 and ary2
nofxx has quit [Ping timeout: 240 seconds]
__butch__ has quit [Quit: Leaving.]
Hakon has joined #ruby-lang
__butch__ has joined #ruby-lang
<andrewvos> tdy: Meh, looks okay to me.
gsav_ has quit [Ping timeout: 246 seconds]
<andrewvos> Hmm wait
<andrewvos> tdy: Close ary1.flatten.zip(ary2.flatten).map {|d| d[0] + d[1]}
<tdy> andrewvos: ah yes.. thanks, i like that more
<andrewvos> tdy: Doesn't work though.
<tdy> ohh
<tdy> returns 1 array
<tdy> err gets rid of the subarrays
<tdy> ok
<zzak> zip.flat.run.hide.jump.walk.crawl.poop
<andrewvos> ary1.flatten.zip(ary2.flatten).map {|d| d[0] + d[1]}.each_slice(2).to_a
<andrewvos> zzak: ary1.fist
<zzak> lol
<andrewvos> tdy: That works, but it's the ugliest thing I have ever seen.
<andrewvos> (Holds back "your mom" joke)
<tdy> haha
<andrewvos> tdy: What are you actually trying to do?
cardoni has quit [Quit: cardoni]
vlad_starkov has quit [Remote host closed the connection]
<zzak> good question
<andrewvos> zzak: Why thank you zzak.
Weems has quit [Read error: Connection reset by peer]
<zzak> are you trying to pad the array or something?
<tdy> andrewvos: ary1 is a grid of values, ary2 is a grid of modifiers.. for to_s purposes, i'm just combining the two grids cell-by-cell
Weems has joined #ruby-lang
Weems has quit [Changing host]
Weems has joined #ruby-lang
<andrewvos> tdy: What are you doing?
<andrewvos> tdy: Why are you doing this?
<andrewvos> tdy: Is this some sort of CS project?
<tdy> aye, a minimax implementation
mytrile has quit [Read error: Connection reset by peer]
ruurd has quit [Quit: Leaving...]
<manveru> >> ary1.map.with_index{|a,i| a.map.with_index{|b,j| b + ary2[i][j] }}
<andrewvos> Not heard that term before. Looks interesting.
<manveru> => [["a1", "b2"], ["c3", "d4"]]
<manveru> not much better...
<zzak> manveru ftw
<manveru> >> ary1.flatten.zip(ary2.flatten).map(&:join).each_slice(2).to_a
<manveru> => [["a1", "b2"], ["c3", "d4"]]
<andrewvos> Exactly the same amount of characters as mine, if you remove the to_a :)
<zzak> i like map with_index better
<andrewvos> zzak: How does that even work?
sailias has joined #ruby-lang
<andrewvos> Suppose I should be asking manveru
<zzak> map is enumerable
<manveru> andrewvos: minimax?
irleif has joined #ruby-lang
<tdy> manveru: thanks
nofxx has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
mistym has quit [Remote host closed the connection]
<andrewvos> manveru: map.with_index
My_Hearing has quit [Ping timeout: 268 seconds]
<manveru> map returns an enumerator
<manveru> if you dno't pass a block
<manveru> >> [].map.class
<manveru> => Enumerator
<andrewvos> with_index?
<manveru> is a method on Enumerator
<andrewvos> TIL there is Enumerator and Enumerable.
<manveru> def with_index; n = -1; loop{ yield(n += 1, next) }; end
<manveru> something like that
<zzak> enumerator is the return of an enumerable when no block is passed
<manveru> of course, with_index also returns an enumerator if no block is passed, so it's a bit bigger
<andrewvos> So you need the map because you want an Enumerator? Devious.
<manveru> no
<manveru> i need the map so i don't need to have the output array variable
anannie has quit [Remote host closed the connection]
anannie has joined #ruby-lang
anannie has quit [Remote host closed the connection]
<zzak> you could also do Enumerator.new(ary1, :with_index, 0, 0) { |...| ...}
<zzak> i thnk
<manveru> i bet this would be like 2 characters in APL
havocjoseph has joined #ruby-lang
<andrewvos> I'm a bit lost on that still. It's been a long day.
<manveru> [].map uses 'return to_enum unless block_given?'
enebo has quit [Ping timeout: 264 seconds]
<zzak> doesn't array mixin enumerable?
sailias has quit [Quit: Leaving.]
<manveru> yeah, for some stuff
<manveru> but Array and Hash also define a ton of enumerable methods themselves for efficiency
<andrewvos> This is blowing my mind. Can you think of a simpler example with .map.with_index so I can understand? This seems like something I need to know.
<zzak> yeh
sailias has joined #ruby-lang
<andrewvos> Ohhh ok wait I'm getting it. Ok map.with_index is cool.
<zzak> they are different
woollyams has joined #ruby-lang
<manveru> hehe
<manveru> gotta love ruby
ridders24 has quit [Ping timeout: 240 seconds]
<zzak> what is RARRAY_EMBED_LEN_MAX?
<manveru> it's pretty insane on the inside, but hides it well
<zzak> from rb_ary_new
<manveru> no idea
<jaimef> and editor should never dictate syntax of a new language like ruby and "end"
<manveru> maybe for the CoW stuff?
<jaimef> an
<manveru> jaimef: "end" was a close call, matz almost didn't get emacs to work with it, so ruby would've had {} instead
<jaimef> manveru: yeap
<zzak> [].map looks like it's using Array() constructor
cardoni has joined #ruby-lang
<andrewvos> ennnnnnnnnnd
<zzak> enum is magic
<manveru> partially
<zzak> what is rb_yield_values2 haha
Tearan has quit [Quit: Sleepy Badger....]
<manveru> what most surprised me was that it uses exceptions for flow control
<zzak> enum.collect uses "rb_ary_push(ary, enum_yield(argc, argv))" in a block instead of "rb_ary_push(collect, rb_yield(RARRAY_PTR(ary)[i]))" from rby_ary_collect
<zzak> im guessing their the same
<zzak> one is invoked in a block and the other in a loop
lcdhoffman has joined #ruby-lang
solars has quit [Ping timeout: 265 seconds]
methods has joined #ruby-lang
<zzak> manveru: i dont see any exceptions, just if Qundef and rb_block_given for control
mistym has joined #ruby-lang
mistym has quit [Changing host]
mistym has joined #ruby-lang
<manveru> e = [].each; e.next
<manveru> e = [].each; loop{ e.next }
<manveru> try both :)
<zzak> oh, i was looking at enumerable
methods has left #ruby-lang [#ruby-lang]
<manveru> ah, yeah
<tdy> is there reasoning behind map.with_index instead of map_with_index
<tdy> or vice versa with each_with_index vs each.with_index
<manveru> tdy: each_with_index was the original
<zzak> "An Enumerator can also be used as an external iterator. For example, Enumerator#next returns the next value of the iterator or raises StopIteration if the Enumerator is at the end"
<manveru> then it was generalized with the introduction of with_index
<tdy> oh
<manveru> not sure about map_with_index
icooba has quit [Ping timeout: 244 seconds]
CaptainJet has joined #ruby-lang
icooba has joined #ruby-lang
Serial_Killer_C has quit [Remote host closed the connection]
Carnage\ has quit []
wyhaines has joined #ruby-lang
Mon_Ouie has quit [Read error: Operation timed out]
Mon_Ouie has joined #ruby-lang
irleif has quit [Quit: Computer has gone to sleep.]
HikkiJP has joined #ruby-lang
icooba has quit [Quit: Computer has gone to sleep.]
sailias has quit [Quit: Leaving.]
workmad3 has quit [Ping timeout: 265 seconds]
coryf has quit [Remote host closed the connection]
jamjam has quit [Ping timeout: 265 seconds]
siyusong has joined #ruby-lang
wyhaines has quit [Remote host closed the connection]
Sambalero has joined #ruby-lang
cardoni has quit [Quit: cardoni]
tos9_ has joined #ruby-lang
vlad_starkov has joined #ruby-lang
justinram has quit [Remote host closed the connection]
vlad_starkov has quit [Remote host closed the connection]
nertzy has joined #ruby-lang
tos9_ has quit [Quit: leaving]
tos9_ has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 246 seconds]
Mon_Ouie has joined #ruby-lang
robotmay_ has quit [Ping timeout: 246 seconds]
tos9_ has quit [Quit: leaving]
HikkiJP has quit [Ping timeout: 246 seconds]
HikkiJP has joined #ruby-lang
havocjoseph has left #ruby-lang [#ruby-lang]
enebo has joined #ruby-lang
nitti has quit [Remote host closed the connection]
HikkiJP has quit [Quit: .•«UPP»•.]
Nisstyre has quit [Quit: Leaving]
Nisstyre has joined #ruby-lang
toretore has quit [Quit: Leaving]
tenderlove has joined #ruby-lang
tenderlove has quit [Remote host closed the connection]
bastilian has joined #ruby-lang
tenderlove has joined #ruby-lang
erichmenge has joined #ruby-lang
nertzy has quit [Quit: Leaving]
bfreeman has quit [Quit: bfreeman]
nertzy has joined #ruby-lang