Topic for #ruby-lang is now Ruby 1.9.3p0: | Paste >3 Lines of Text on
<zenspider> jaimef: lemme know if that doesn't make sense
Mithos^ [Mithos^!] has joined #ruby-lang
workmad3 [workmad3!] has joined #ruby-lang
<zenspider> JosephRuby: ok. I added a comment pointing out that it can be made 80% faster very easily... but I'm not going to just give you the code... you'll learn more if you work through it
<zenspider> too bad I didn't make the comment on stack overflow... I could be earning ... points... or something
<infid> you know what the say... the larger the stackoverflow pointage, the larger the loser
<zenspider> hah
<zenspider> I had a running bet with someone in here that I wouldn't use stackoverflow over the next year. I don't remember who it was with or what the wager was for but I want to collect :P
<infid> I give it a hard time but I do like the site overall
<zenspider> I think it is yahoo answers for code
<samuelkadolph> Nah, they suggest you add sources to Yahoo! Answers
<infid> I remember when answering questions on IRC felt competitive. Whoa man, SO takes that to a new annoyance. You spend time answering a question and by the time you hit submit 5 people have beat you to it, and because they answered first the question asker ends up accepting their answer and rarely returning to see yours
<jaimef> zenspider: it does, never used optional params before. thanks
<infid> IRC is different. You answer a question and the question asker /quit's before you hit Enter
<zenspider> jaimef: awesome
hangingclowns [hangingclowns!~Adium@] has joined #ruby-lang
<infid> Nah, it's way better than any type of Yahoo! Answers. Those are always the worst answers. At least on SO you're bound to get at least one intelligent answer.
<infid> Everyone at my work who has said that SO sucks, I catch using it at least once a day as I walk by their desk. It's like Hanson when they first came out. Everyone said they sucked, yet listened to them secretly.
<shevy> infid well that is just because some people don't know how to work IRC
<shevy> or they are impatient
<shevy> but the key to IRC is to idle to power
<zenspider> idle to power? hah
jmontross [jmontross!] has joined #ruby-lang
<infid> IRC feels more social than any new trend such as Facebook, Stackoverflow or Google+
<hangingclowns> anyone know why I can't seem run spec tests for a gem?
<hangingclowns> it keeps not picking up a constant
<hangingclowns> I'm using autload for require statements
<confounds> hangingclowns is anything ever truly constant?
jasmin [jasmin!~jasmin@] has joined #ruby-lang
<infid> not even constants are constants once the program exists :(
<hangingclowns> haha
<confounds> exactly
<hangingclowns> actually, I'm trying to include a module in a class
<hangingclowns> but it can't seem to pick up on it?
<hangingclowns> I have one file where everything is loaded from autoload :Class, 'path'
<infid> the term "volatile memory" feels redundant
havenn [havenn!] has joined #ruby-lang
<samuelkadolph> Sure but no one says that
<samuelkadolph> There is volatile variables.
<hangingclowns> ahh, anyways, I figured it out
<zenspider> why are you using autoload at all?
<hangingclowns> I included all files, when I should just include one
<hangingclowns> why?
<hangingclowns> is it a bad idea?
<zenspider> is it a good idea?
<hangingclowns> I'm using a gem
<hangingclowns> i'm building a gem and I have like, so far, over 60 classes
<hangingclowns> but I wnat to be able to use any class if I want to
<hangingclowns> so why load every class into memory if say I only want to use 1 or 2?
srbartlett [srbartlett!~srbartlet@] has joined #ruby-lang
<infid> sounds more like the Mother Load then a Gem
<zenspider> hangingclowns: who said you had to load every class?
kain [kain!~kain@] has joined #ruby-lang
<hangingclowns> so then what do you recommend?
<samuelkadolph> Don't do anything
<zenspider> not doing autoloads
<samuelkadolph> Any code that needs your class has to require i
<samuelkadolph> it*
<hangingclowns> so i'd have to require my users to load every piece that they want to use?
<hangingclowns> sounds like a hassle for them
<zenspider> wtf are you writing that needs 60 classes anyhow?
<hangingclowns> data migration and configuration
<hangingclowns> for an erp sytem
<shevy> infid well, I'll never use facebook or google+, I don't see the point in providing more and more data to companies myself when it's already horrible enough as is. but stackoverflow is not so bad
<zenspider> then they're enterprisey lemmings and expect to be inconvenienced
<infid> are you writing a Gem or Mr Holland's Opus
<hangingclowns> if it can play music, then maybe I can retire early :)
<zenspider> I don't see a problem in having to require what you actually use.
<shevy> hehe
<infid> shevy: I don't blame you
<shevy> define "early" ;D
<zenspider> makes code more clear imhfo
<hangingclowns> yeah, it can...
<hangingclowns> but what it comes down to...
<hangingclowns> this system is so massive and code changes everyday
<hangingclowns> i just starting writing tests
<infid> shevy: I love how all companies these days have tricked everyone into giving them their private information by making it seem cool or convenient
* zenspider sighs
<shevy> infid convenience is a powerful thing
<hangingclowns> not to mention I'm the only ruby guy here, everyone else is munching on the Python juice
<hangingclowns> oh yeah, was also wondering...
<infid> shevy: it's hard to balance things. Obviously I'm not going to give up my cellphone or gmail and go live in the woods
<jaimef> so I have output that uses \n\n to split records. trying to identify just those records containing a filter. however foo.split("\n\n").each {|a| puts "yes" if a.match(/bar/) } is not working
<hangingclowns> anyone know if it's best to go straight from CSV to XML, or should I load things into a database, too?
<shevy> hangingclowns beat them with beautiful poems as code!
<hangingclowns> shevy: I do, everyday
<infid> we may fear corporations knowing too much about us but the government already does
<zenspider> is 'of' a keyword/builtin/whatever in zsh or any other shell you guys know of?
<hangingclowns> I convinced them to use Rake to run tasks rather than doing everything by hand
xjiujiu [xjiujiu!~quassel@] has joined #ruby-lang
<zenspider> hangingclowns: "best" is a red herring
<hangingclowns> red herring?
<hangingclowns> Files: 68
<hangingclowns> Modules: 11 ( 0 undocumented)
<hangingclowns> Classes: 67 ( 0 undocumented)
<hangingclowns> Constants: 45 ( 0 undocumented)
<hangingclowns> Methods: 253 ( 0 u
<hangingclowns> massive gem, right?
<infid> hangingclowns: why go from CSV to XML? Why not start with XML since it can do things that CSV can't? What are you trying to accomplish?
<hangingclowns> I sure hope it can play me beautiful music?
<shevy> ewww moving to XML
<shevy> today is a sad day
<hangingclowns> I've got CSV files that come from a customer, and I wnat ot load them into CSV to load into a system
<infid> hangingclowns: if you can 'start' with a database, then allow it to export to csv, xml, etc if needed
<zenspider> meh. 253 methods is not that much overall. and yes, "best" is a red herring.
<infid> hangingclowns: I'd load them into a database then, straight
<zenspider> esp with such a poorly worded question.
<shevy> oh cool... now I should count how many methods my projects have
<hangingclowns> yeah, but I saw Mongodb, and I was impressed...
<hangingclowns> I wnated to use it
<infid> hangingclowns: there are ETL tools that can do stuff like that i'm sure, if you don't want to do it yourself
<hangingclowns> I'm used to relational databases, not used to using this "document"-style loading
<hangingclowns> what's ETL?
<infid> extract/transform/load (iirc)
<hangingclowns> never heard of that
<infid> lots of businesses get csv files to digest and process everyday, it's a long solved problem
<hangingclowns> yeah it is
<hangingclowns> but I think there's not quite an easy way around this part
<hangingclowns> plus, it's not for certain if the data will be even ready by the time it gets to me
<hangingclowns> i've got a pretty good system down
twittard [twittard!] has joined #ruby-lang
<infid> I wouldn't conver them to XML. If you need to process them and discard them, then do so. Preferably by storing the csv in a decent looking data structure
<hangingclowns> i make a model for every database table I've run into so far
<hangingclowns> not much I can do
<hangingclowns> I need them in XML
<hangingclowns> cause sometimes I need to reference them later on
<hangingclowns> and we need to save them in a file for use later
<hangingclowns> trust me, there's no way around this
<infid> I don't trust you :p
<hangingclowns> haha
<hangingclowns> okay, here's what's up
<hangingclowns> i take some customer data, and convert it into XML
<hangingclowns> XML that's readable by OpenERP
<hangingclowns> I take all of their XML, make it into a module
<hangingclowns> so the customer is buying a module from us
<hangingclowns> and all they do it drop it into their system, and turn on the module
<hangingclowns> the system loads their data in and BAM
<hangingclowns> everyone is happy
<hangingclowns> the system is ready and configured for their use
<hangingclowns> say that their system blows up
<hangingclowns> no big deal
<infid> referecing them and "needing" them for later use is a good need for a real database, not xml files. And that way you can run sql on it, generate xml, csv or whatever files you may need in the future
<hangingclowns> they just drop the DB and reload the module
savage- [savage-!~savage-@] has joined #ruby-lang
<infid> so i would go csv -> rdbms (or even nosql if sufficient) -> xml
<hangingclowns> mmm
<hangingclowns> its' been crossing my mind
<hangingclowns> right now I have a steady system of a builder that corresponds to a model, and a model
<hangingclowns> a builder is responsibile for building an array of models
<hangingclowns> the builder reads in a CSV file, and according to the headings at the top, makes the models
<hangingclowns> well, model
neoesque [neoesque!~neoesque@] has joined #ruby-lang
<hangingclowns> and then, after that, the builder is only responsible for startign the XML buildling process
<hangingclowns> it just passes the Nokogiri::XML::Builder object to the model
<hangingclowns> and the model just adds itself to it
<hangingclowns> so everyting is done in memory, for now
<infid> what if in a month you need it to do something besides xml, and to convert all past records to a new format
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
<bougyman> you don't raelly have to choose between rdbms and nosql for xml, per se.
<bougyman> postgres has an 'xml' data type
<bougyman> understands xpath, can even index by it.
<infid> mysql has a csv table too
<hangingclowns> actually, we do use postgres for the Openerp
<hangingclowns> i haven't looked much into postgres
<bougyman> hangingclowns: um.
<bougyman> then why not just dump as data you can COPY in to postgres?
<bougyman> COPY is by far the fastest, most efficient way to get data in to postgres.
<hangingclowns> yeah, but if the data is not ready by the time it gets to me, still gotta play with it
<bougyman> i thought you had a module on their system?
<infid> Agreed. If you're fortunate enough to already have postgres available, then by all means use the beautiful thing :)
<bougyman> maybe I misread,.
<hangingclowns> no
<hangingclowns> the idea is that we MAKE the module
<hangingclowns> and they buy the module from us
<infid> turnkey
<bougyman> and what does the module do?
<hangingclowns> the module just consists of their company data and anything else that we add to it
<hangingclowns> cause every business has different processes
<bougyman> yes, we call this ETL on our team
<hangingclowns> so we need to add that into the system, whether we do that with XML or python code
<bougyman> extract, transform, load.
<hangingclowns> yeah, exactly
<bougyman> there are a TON of commercial ETL products, and quite a few open source ones.
<hangingclowns> if we need to edit the database, then we have to use python, if we just load in data, we use CSV or XML
<infid> Pentaho is a decent ETL one
<bougyman> Pentaho is quite comprehensive.
<infid> might be overkill
<infid> but it allows you to just do the simple thing you want, and do more later if needed
<bougyman> i find generic business object software like that generally includes way more than any one process needs.
<bougyman> cause it has to be the everytransformer.
robglees_ [robglees_!] has joined #ruby-lang
<bougyman> we just wrote a generic one internally and use that as the base for every new client-data ETL
<hangingclowns> right now, this system is going pretty well so far
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
<hangingclowns> it's better than the old system, I think
<bougyman> so each client has their own classes on top of our base classes that does their funky-specific tranformations.
<hangingclowns> yeah
<hangingclowns> i have something like taht
<hangingclowns> I have a basic Base class that just loads all attributes into an attributes hash
<hangingclowns> everything else builds on that
<bougyman> ours writes everything into postgres.
<hangingclowns> like relationships
<bougyman> cerates the tables, models, etc.
<bougyman> reads a csv header or what-not for field/atribute names, but allows remapping, of course.
<hangingclowns> but, can you imagine the hassle of giving someone a DB and telling them to load it into their postgres?
<bougyman> hangingclowns: i thought your module would handle the transformation into what you hold vs what they desire as output.
<bougyman> anv the other way around for export.
<hangingclowns> well the idea is that many times, we get some messed up shit
<bougyman> no idea, that's your ship.
<hangingclowns> like some crazy excel charts and stuff
<bougyman> yes, client-supplied data generally sucks.
<hangingclowns> have to sift through all that crap
<bougyman> no.
<bougyman> you read all the cood and have the bad go to a manual-bullshit bucket.
<bougyman> you should only have to touch the exceptions.
<hangingclowns> anyways, like I said, so far its' going well and it doesnt' take me long to make up a class in it
<bougyman> the ones I hate the most are the old unix exports.
<bougyman> no sane separator, multi-line records with arbitrary fields.
<hangingclowns> i'm lucky if they ever heard of Linux over here
<bougyman> that's when, unfortunately, I resort to regex (and thusly, luck).
<bougyman> oh none of the people who have those are unix people.
<bougyman> they have some old FACS or PICK box in the back office that spits this junk out.
<bougyman> er s/FACS/MUMPS/
<hangingclowns> yeah, sounds like you have more fun at work than I do
<zenspider> old unix...
<zenspider> heh
<bougyman> i wrote the core of what we use, i don't touch it much anymore, though.
<hangingclowns> that's the plan!
<bougyman> we have a great gal in india who programs most of our etl now.
<hangingclowns> write once, don't touch again
<hangingclowns> except maintenance
<bougyman> we push the data into postgres... then into PICK from postgres.
<bougyman> this industry runs almost completely on PICK and MUMPS.
<hangingclowns> so it's a bad idea to go from CSV to straight XML?
<bougyman> i don't see any value in it.
<bougyman> csv is less filesystem space for the same amount of data.
febits[0] [febits[0]!~tony@] has joined #ruby-lang
febits[0] [febits[0]!~tony@unaffiliated/bits58] has joined #ruby-lang
<bougyman> you already restrict yourself in csv so that xml can add no value to the data richness.
<hangingclowns> ahh
<hangingclowns> got ya
<hangingclowns> yeah, but not much data richness I think
<bougyman> if your initial export were XML i'd say not to bother going to CSV, as well.
<bougyman> it's your boat, you gotta decide how to sail her.
<hangingclowns> haha
<hangingclowns> yeah, it is, but I gotta ask which way has the best wind, right?
<hangingclowns> but in the end, it's my baby
<bougyman> i'd say: take any junk they want to throw at you in.
<bougyman> and you have to offer what, about 4 kinds of exports?
<bougyman> what you do internally is 100% your choice.
<hangingclowns> only has 2, right now
<hangingclowns> only will be two as far as I can see
<hangingclowns> system only allows CSV or XML
<bougyman> you can't really tell them how to give you the data, not if your "value-add" is to make their job easier. some of these companies we've worked with take 4 weeks to get a new report programmed to do something as simple as produce a TSV (tab-separated) or fixed-length export.
<hangingclowns> and XML is much easier to link with other data files
dv310p3r [dv310p3r!] has joined #ruby-lang
X99 [X99!~quassel@] has joined #ruby-lang
savage-_ [savage-_!~savage-@] has joined #ruby-lang
savage-_ [savage-_!~savage-@] has joined #ruby-lang
heppy_ [heppy_!] has joined #ruby-lang
jmontross [jmontross!] has joined #ruby-lang
savage- [savage-!~savage-@] has joined #ruby-lang
hangingclowns [hangingclowns!~Adium@] has quit [#ruby-lang]
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
febits[0] [febits[0]!~tony@unaffiliated/bits58] has joined #ruby-lang
amh345 [amh345!~amh345@unaffiliated/amh345] has joined #ruby-lang
<amh345> this started as a rails question. but i believe it's more ruby so i shall ask here :) >> will return true/false. what do i need to do in ruby to get the entire result and not just a true/false? i need to get the value from another col if include is true.
SuperTa__ [SuperTa__!] has joined #ruby-lang
<zenspider> don't do the include?(true) ?
<zenspider> I can't/won't guess at what col1 does...
<amh345> if i dont include?(true) i get the entire result from the map(&:col)
<amh345> which could contain many records in a hash
<zenspider> you just said you wanted the entire resul
<zenspider> t
<amh345> i just need the one result (if there is one) with all it's details. just just a single col
<amh345> not* just a single col
<amh345> i've been at this for hours
<zenspider> then... you prolly want to replace .include?(true) with find { |x| x.include? true }
<zenspider> but again... you're not asking very well
<mephux> yea, I just read the question and have no idea what you mean by `entire result`
<amh345> i need to find a col with the value of true. but the table has many cols. so when i find the true result. i need to get other details from it. now it's sounding more like a rails question.
<zenspider> yes, it is
<injekt> go fourth and #ror!
<zenspider> I suspect: var.model.find { |m| m.table.any? { |x| x.col } }
<amh345> it doesnt have to be a table. it could just be a hash.
<amh345> if it was just a hash then it's be ruby :)
<zenspider> you want to ask the RIGHT level your question.
<zenspider> you're asking too low
<zenspider> but again... your question kinda sucks so I'm making this up as I go along
<injekt> amh345: protip: simplify your question, perhaps provide a snippet with example code and the output you're looking for
<zenspider> does anyone here use emacs' ediff/emerge/something-else to apply a patch file to multiple files?
<injekt> it can help a lot
<amh345> this is the snippet
<injekt> dude you forgot the simplify step
<injekt> that looks like shit
<injekt> no offence
<mephux> agree
<injekt> offense
<amh345> well it's functional code.
<zenspider> corsican: questions?
<zenspider> corundum: questions?
<corundum> no clue
<zenspider> corundum: how to ask questions?
<corundum> don't ask me
<injekt> zenspider: :P
<sbeam> amh345: { |t| t.col1.present? }
<zenspider> corundum: you suck
<injekt> corundum: asking?
<corundum> dunno
<injekt> fu
<injekt> corundum: how to ask?
<corundum> no idea
<zenspider> corundum: questions is
<corundum> okay
<injekt> no botsnack for you
<zenspider> oh fuck you google.
<zenspider> asshats
<injekt> oh come on zenspider
<injekt> COME ON BRO
<zenspider> corundum: no, questions is
<corundum> aight
<amh345> sbeam: i think that's it!
<zenspider> MY PINKY IS TOO FAST!
<injekt> D:
<injekt> quite.
<zenspider> also... fuck google
<zenspider> when did they start that shit?
<injekt> not happening for me
<injekt> ah yes it is
<injekt> fuck
SuperTaz_work [SuperTaz_work!] has joined #ruby-lang
<injekt> that's some bullshit
<zenspider> haha
<amh345> yup, sbeam that did it. thank you very much. i was way off
dhruvasagar [dhruvasagar!~dhruvasag@] has joined #ruby-lang
mpan [mpan!477eada2@gateway/web/freenode/ip.] has joined #ruby-lang
<mpan> Hi guys, I'm wondering if anyone knows which IRC library is commonly used. Would be preferable if it is actively maintained.
<zenspider> fuck. even magit is f'ing with me
<zenspider> man I fucking hate git
takaokouji [takaokouji!] has joined #ruby-lang
Skif [Skif!] has joined #ruby-lang
<lianj> mpan: try cinch
Axsuul [Axsuul!] has joined #ruby-lang
sodani1 [sodani1!] has joined #ruby-lang
<zenspider> yay! finally got through the merge hell
<zenspider> and YAY! rubygems is moving again!
<sodani1> hello. can someone tell me how I can prevent cookies from being stored in a Mechanize agent?
sh1nji [sh1nji!] has joined #ruby-lang
<zenspider> well... you can call clear! on the cookie_jar I guess...
mndoci [mndoci!~mndoci@] has joined #ruby-lang
<sodani1> zenspider: thanks. i just realized that i'm creating a new instance anyway so it doesn't matter
towski [towski!] has joined #ruby-lang
ascarter [ascarter!] has joined #ruby-lang
guns [guns!] has joined #ruby-lang
denysonique [denysonique!~dennis@unaffiliated/dennisonicc] has joined #ruby-lang
<denysonique> hey
<denysonique> my friend says that you can do this in Scala: List(1, 2, 3) map (+1)
<denysonique> In Ruby you can do ['1', '2', '3'].map(&:to_s) for example
<denysonique> but is it possible to pass args as well?
<injekt> denysonique: your examples do different things
<injekt> what are you actually trying to do?
<denysonique> yes
<denysonique> I am trying to do [1,2,3].map{ |x| x +1 }
<denysonique> using the short syntax
<denysonique> the Symbol#to_proc way
<samuelkadolph> [1,2,3].each_with_object(1).map(&:+)
<injekt> no, you cant pass args using to_proc
<injekt> [1,2,3].inject(:+)
<injekt> um
<samuelkadolph> That's wrong
* injekt punches himself
<injekt> SHHH
<injekt> it's late
<samuelkadolph> There was a proposed syntax to add args to the block with the &symbol syntax but I can't remember if it made it in
yadav [yadav!] has joined #ruby-lang
<injekt> na it didn't
<injekt> it was really ugly, too
<samuelkadolph> I can't remember what it was. Something like &:foo(1)
<injekt> map(&:+[1]) or something
<denysonique> samuelkadolph, injekt, thanks
<injekt> and of course, if it's only ever +1 you want (it's probably not), then just use map(&:succ)
SuperTa__ [SuperTa__!] has joined #ruby-lang
<zenspider> if they add that in, I'm forking ruby
<injekt> hah
<injekt> with style like that, it'll never make it in
<ryanf> you could use ampex
<zenspider> no, prolly not
<ryanf> [1,2,3].map &X.+(1)
<ryanf> I think?
<injekt> tbh, I dont see much problem with {|x| x + 1 }; { _ + 1 } might be cool
<injekt> ryanf: that makes no sense to me
<injekt> is .+ the method or is X :P
<ryanf> x is an object that has zany properties
<ryanf> I mean X
<zenspider> we really don't need more magic syntax... we have too much as it is
<ryanf> ah I guess you can do [1,2,3].map &(X + 1) too
<injekt> heh
<ryanf> if you want more details, either go to the github page I linked or ask cirwin about it
<ryanf> or both
Asher [Asher!~asher@] has joined #ruby-lang
<zenspider> honestly... if someone used that in production on one of my systems, I'd fire them on the spot
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
<zenspider> that's fucking horrific
<ryanf> haha
<ryanf> zenspider: if you want horrific, check this out:
<ryanf> coffeescript fork with a kitchen-sink approach to syntax features
<ryanf> search for "backcall" to see my favorite code sample
<zenspider> front end isn't my problem
<samuelkadolph> zenspider: Use what?
<ryanf> samuelkadolph: ampex
<samuelkadolph> Ah
<samuelkadolph> Looks interesting
Tref [Tref!] has joined #ruby-lang
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
Banistergalaxy [Banistergalaxy!~AndChat@] has joined #ruby-lang
Stax [Stax!] has joined #ruby-lang
banistergalaxy_ [banistergalaxy_!~baniseter@] has joined #ruby-lang
petercooper [petercooper!~petercoop@] has joined #ruby-lang
<br1an> so do you all dislike ampex? I'm kind of impressed/intrigued, but not sure if the juice is worth the squeeze..
<br1an> looking over the source though, good to know it exists anyway
<zenspider> well then... I guess you're fired :P
<br1an> heh
<br1an> well, i havent finished reading source eyt, or decided if i would use :-)
<br1an> but i'd probably deserve to be fired from some jobs :-)
<shevy> some? how many you got!
<br1an> is it an aesthetic issue, a performance/obfuscation issue, or other, in yourmind zenspider ?
<zenspider> it is a clevar issue
<br1an> shevy: well, not from the job I have, but form some jobs I don't I might deserve it, for that or other things :_)
<zenspider> I'm down to 2 minutes of battery tho, so I'm not going into details
<br1an> no worries, just curious...
<br1an> some things are too clever by half, but I'm stilld eciding/figuring out where line is and whatnot :-)
<br1an> zenspider: you on android, ios or other? i put colloquy on iphone but not liking it
<br1an> might just try irccloud on the phone actually now i think of it
<br1an> (oh, forgot you might be on a notebook)
<lianj> oh wait, maybe just check is the string is odd? and add a '0' then?
<br1an> lianj: i dont understand link
Gushings [Gushings!] has joined #ruby-lang
<br1an> oh, wait, maybe i do
lsegal [lsegal!] has joined #ruby-lang
<br1an> you want to right justify the formatted text in console? or...?
<lianj> no, just the correct hex output of that huge int
<ryanf> zenspider just hates fun
<ryanf> I think ampex is cute, not sure if I'd use it in production (and get fired by zenspider) thoug
<ryanf> *though
<br1an> lianj: correct how? whats there is incorrect? what does rjust mean if not right justify?
<br1an> ryanf: hmm, maybe it'd be a good thing just to have in irb or console for doing quick stuff...
<ryanf> yeah I think that's a great use case for stuff like that
<lianj> ["100"].pack("H*") != ["0100"].pack("H*")
<banistergalaxy_> you could play edge games with it, have the screen open on the ampex source when zenspider is in the room but closing it before he passes by your desk, and eeach time you keep it open for a little bit longer, increasing the chance he'll see it. Eventually it becomes a kind of perversion, and you actually want to get caught until one day you turn towards him with the source on your screen and eyes shining saying 'fire me, zen
<banistergalaxy_> spider, fire me'
Marco [Marco!] has joined #ruby-lang
<br1an> lianj: right, 0100 is octal i think, right?
<lianj> br1an: i want the last line's result, just not with reverse.pack.reverse.unpack madness. no 01 00 would be hex
<br1an> oh, maybe in JS it's octal
<lianj> trolling?
<br1an> not trying to, but maybe i'm confused :-)
<lianj> heh ok
<br1an> if you type 0100 into irb, it interprets it as 64
<br1an> that's octal 100, no?
<lianj> its a string at my example
<lianj> br1an: and yes, [0b0100, 0o0100, 0x0100]
<lianj> but that not my problem there
<br1an> nod, sorry, i got confused, trying to figure out if i can help constructively now :-)
<br1an> probably not but willing to try :-)
<lianj> haha ya, thanks
<lianj> now the link is up in the backlog, and chances lower someone looks at it xD
<lianj> zenspider: any hints? :>
<br1an> apologies :-)
arthurlockhart [arthurlockhart!] has joined #ruby-lang
<lianj> no need to, its fine
<br1an> i was thinking maybe some way to use marshal as i kind of feel youre doing somethign similar, but maybe not
<br1an> i'm not totally clear on what youre doing this for :-)
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
<lianj> that why i pasted the example, i want the correct hex representation of that huge integer
<br1an> but the to_s(16) isnt right because its missing a leading 0?
<lianj> str.rjust doesnt work because the length of those ints is not fixed.
<lianj> br1an: right
<lianj> reverse.pack.reverse.unpack feels mad. the .odd? solution might work to but i'm hoping someone pulls out another fine solution
* troubleman is now playing: Troubleman - Untitled (
SuperTa__ [SuperTa__!] has joined #ruby-lang
gnufied [gnufied!~gnufied@] has joined #ruby-lang
<br1an> yeah, i was thinking i.length.even? ? i : "0"+i
<br1an> seems less ugly/crazy anyway, and probably more efficient :-)
imperator [imperator!] has joined #ruby-lang
<lianj> specs all pass. yea i will go with that, for now
brianpWins [brianpWins!] has joined #ruby-lang
x0F_ [x0F_!~x0F@unaffiliated/x0f] has joined #ruby-lang
bobess_log_bot [bobess_log_bot!] has joined #ruby-lang
headius [headius!] has joined #ruby-lang
arthurlockhart [arthurlockhart!] has joined #ruby-lang
rippa [rippa!~splitta@] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
arthurlockhart [arthurlockhart!] has joined #ruby-lang
NinoScript [NinoScript!] has joined #ruby-lang
arthurlockhart [arthurlockhart!] has joined #ruby-lang
arooni-mobile [arooni-mobile!~arooni-mo@] has joined #ruby-lang
igotnolegs [igotnolegs!] has joined #ruby-lang
csherin [csherin!~csherin@] has joined #ruby-lang
lsegal` [lsegal`!] has joined #ruby-lang
lsegal [lsegal!] has joined #ruby-lang
NinoScript [NinoScript!] has quit [#ruby-lang]
Nisstyre [Nisstyre!] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
S1kx [S1kx!~S1kx@pdpc/supporter/monthlybyte/s1kx] has joined #ruby-lang
JosephRuby [JosephRuby!~joseph@] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
<josh9> i have a route that looks like this - /products/:store where i instantiate a store object. it can be target/cvs/walmart etc.
<josh9> i can use a case statement to decide which object to create, but that seems a bit ugly.
<josh9> another option is to use a factory method. something like this:
<josh9> store_name = params[:store]
csherin [csherin!~csherin@] has joined #ruby-lang
<josh9> store =
<josh9> but all I did here is moved the case statement into the StoreManager's constructor.
<josh9> any opinions?
<ryanf> what is your objection to the case statement?
<ryanf> if you really feel the need to be clever about it, you could do store = Stores.const_get(params[:store]).new
<josh9> ryanf: i have a case statement, but now it's hidden inside the factory object
<ryanf> where your stores are Stores::Walmart, Stores::Target, etc
<josh9> ryanf: what's Stores? the manager Class?
<ryanf> no it's just a module
<ryanf> to hold the classes, so that you know const_get isn't going to give you something weird
<josh9> what's const_get?
<ryanf> I bet you can figure it out if you apply yourself :)
<josh9> ryanf: will do. thanks
<ryanf> hmm actually that still might not be the best idea, I didn't know const_get could get arbitrary top-level objects
<ryanf> maybe just stick with the case statement
<ryanf> if you have like module Stores; class Target; end; end and then Stores.const_get('Target'), you'll get Stores::Target back
<ryanf> but if you do Stores.const_get('Object'), you'll just get Object
<ryanf> so that's not really ideal
<ryanf> because then the user could make you instantiate any class
<ryanf> not that that's necessarily a huge problem, but, you know, not great.
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
Marco [Marco!~marco@pat148.vpn.border2-cfw.Dartmouth.EDU] has joined #ruby-lang
spuk [spuk!~spuk@unaffiliated/spuk] has joined #ruby-lang
<josh9> ryanf: i am looking at the definition of const_get - 'The value of the constant is returned if a definition is found'
<josh9> so if i pass a class name, it return the value of this class. does that mean it create an instance of that class?
<josh9> sorry if it's a stupid question.
<josh9> i'll just try it
<josh9> works. thanks!
<rippa> josh9: it returns reference to that class
<josh9> rippa: got it
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
Marco_ [Marco_!] has joined #ruby-lang
gokulnath [gokulnath!~gokulnath@] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
<postmodern> is there a way to hide an instance variable from the default Object#inspect method?
<shyouhei> postmodern: no. write your own #inspect.
twittard [twittard!] has joined #ruby-lang
looopy [looopy!] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
levifig [levifig!] has joined #ruby-lang
<josh9> i just noticed something interesting with the include method. when i am including a module and i am outside any class or a module it allow me to refer to my classes withouth the <module-name>::
<josh9> is my observation correct?
confounds [confounds!] has joined #ruby-lang
<rippa> you are inside the main
amerine [amerine!] has joined #ruby-lang
burgestrand [burgestrand!] has joined #ruby-lang
<josh9> rippa: i believe so, since it almost the top of the file and it's not in any scope of module/clesss
<josh9> class
<rippa> main is an instance of Object
<rippa> so you are including into Object
<josh9> rippa: oh. is it a bad practice?
<rippa> depends
<rippa> if it works for you, use it
<josh9> rippa: i guess i can keep using :: but it gets annoying
<rippa> you can also do something like
<rippa> MyClass = MyModule::MyClass
<josh9> good tip
<rue> It's less scattershot, so typically better
vesan [vesan!] has joined #ruby-lang
chris2 [chris2!] has joined #ruby-lang
<queequeg1> I'm trying to execute a method that I'm looking up in a hash. :
<queequeg1> Should I be able to make it work?
<rippa> queequeg1: send(Conversion_Methods[conversion_method], degrees)
looopy [looopy!] has joined #ruby-lang
<queequeg1> is that send bare or do I have to attach it to something? I'm getting a "nil is not a symbol" error.
<ryanf> that means you tried to get a nonexistent value from the hash
<queequeg1> hrm, I will puts to see what is getting sent.
<ryanf> the send doesn't need to be attached to anything because you want to call it on the same object that you'd otherwise be calling the method on
<ryanf> which in this case is the top-level object
<ryanf> you could also do method(Conversion_Methods[conversion_method]).call(degrees) fyi, I can't think of an advantage over send though
<ryanf> and it'll be slower
<rippa> all put methods in array
<rippa> *or
<rippa> *hash
<ryanf> ah yeah
<rippa> derp
<ryanf> you could do ConversionMethods = {:f2c => method(:convert_from_fahrenheit_to_celcius)...}
<ryanf> and then your original code would work
<queequeg1> ah
<queequeg1> let me try that.
<ryanf> the underscore for uppercase vars isn't normal style btw, that's why I just forgot it :)
<ryanf> uh by uppercase vars of course I mean constants
<queequeg1> I was trying to have it be a constant.
<ryanf> yeah I'm just saying the normal ruby naming convention is ConversionMethods instead of Conversion_Methods
<ryanf> that's all
<queequeg1> Ah, right.
<queequeg1> ooops.
<infid> next you'll be calling }'s "squigglies" :p
<queequeg1> Thanks for the help. Nice to see the code do what I wanted it to rather than what I told it to :-)
<rippa> no, ~ is squigglie
corn_man [corn_man!kvirc@unaffiliated/cornman] has joined #ruby-lang
<ryanf> what's ~> though
<infid> squigglie pacman
<rippa> it's sperm operator
<infid> haha
<infid> sperm and eggs > spam and eggs
<robgleeson> ryanf: the approximate operator, or sperm operator
<robgleeson> ryanf: has a few names, but approximate operator was suggested as well, since some ppl found sperm operator insulting
mindgame [mindgame!] has joined #ruby-lang
<ryanf> I know, I was just seeing if anyone would say spermy
<robgleeson> oh right sorry, came here late :D
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
heftig [heftig!jan@archlinux/developer/heftig] has joined #ruby-lang
chendo_ [chendo_!~chendo@] has joined #ruby-lang
livinded [livinded!] has joined #ruby-lang
kitallis [kitallis!~kitallis@] has joined #ruby-lang
csherin [csherin!~csherin@] has joined #ruby-lang
nicknovitski [nicknovitski!~nicknovit@] has joined #ruby-lang
gnufied [gnufied!~gnufied@] has joined #ruby-lang
looopy_ [looopy_!] has joined #ruby-lang
shevy [shevy!] has joined #ruby-lang
nicknovitski [nicknovitski!~nicknovit@] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
chendo__ [chendo__!~chendo@] has joined #ruby-lang
chendo__ [chendo__!~chendo@] has quit ["Leaving..."]
huugsy [huugsy!] has joined #ruby-lang
<mindgame> if I want to match any term of an array, what do I say
<mindgame> if Array.subset (term); code
<erikh> look at Enumerable, namely #any? and #include?
srbartlett [srbartlett!~srbartlet@] has joined #ruby-lang
Defusal [Defusal!] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
frangiz [frangiz!] has joined #ruby-lang
kain_ [kain_!~kain@] has joined #ruby-lang
headius [headius!] has joined #ruby-lang
Heimidal [Heimidal!] has joined #ruby-lang
|Vargas| [|Vargas|!] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@pdpc/supporter/profesional/vargas] has joined #ruby-lang
ryanf [ryanf!] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
yorickpeterse [yorickpeterse!~yorickpet@pdpc/supporter/professional/yorickpeterse] has joined #ruby-lang
<yorickpeterse> Morning
RegEchse [RegEchse!] has joined #ruby-lang
cyri_ [cyri_!] has joined #ruby-lang
NinoScript [NinoScript!] has joined #ruby-lang
Pip [Pip!] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
Banistergalaxy [Banistergalaxy!~AndChat@] has joined #ruby-lang
<mindgame> is there a way to remove the has join & quit msgs on mIRC
yxhuvud [yxhuvud!] has joined #ruby-lang
snuy [snuy!] has joined #ruby-lang
<snuy> i'm using openssl with ruby and want the server not to ask the client for a client certificate. any suggestions?
kyrylo [kyrylo!~kyrylo@] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@] has joined #ruby-lang
molgrew [molgrew!~bozo20@] has joined #ruby-lang
Banistergalaxy [Banistergalaxy!~AndChat@] has joined #ruby-lang
postmodern [postmodern!] has joined #ruby-lang
Defusal [Defusal!] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
corn_man [corn_man!kvirc@unaffiliated/cornman] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@] has joined #ruby-lang
DuoSRX [DuoSRX!~user@2a01:e34:edd7:4330:3615:9eff:fe93:de4e] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
thrcka [thrcka!] has joined #ruby-lang
<mindgame> whats the command in irb to get out of line? Ex 12:1";13:1"
sh1nji [sh1nji!] has joined #ruby-lang
headius [headius!] has joined #ruby-lang
Eising [Eising!] has joined #ruby-lang
datanoise [datanoise!] has joined #ruby-lang
datanoise [datanoise!] has joined #ruby-lang
<rue> No idea what that means
<rue> ^D will let you discard code if you're in a multiline expression
dr_bob [dr_bob!c100f615@gateway/web/freenode/ip.] has joined #ruby-lang
perryh [perryh!~root@unaffiliated/perry753] has joined #ruby-lang
ioga_wrk [ioga_wrk!~ioga@] has joined #ruby-lang
snuy1 [snuy1!] has joined #ruby-lang
workmad3 [workmad3!] has joined #ruby-lang
voker57_ [voker57_!~voker57@] has joined #ruby-lang
burgestrand [burgestrand!] has joined #ruby-lang
benanne [benanne!] has joined #ruby-lang
Natch| [Natch|!~natch@] has joined #ruby-lang
Weems [Weems!~frodo@unaffiliated/weems] has joined #ruby-lang
Para [Para!~Para@] has joined #ruby-lang
jensn [jensn!] has joined #ruby-lang
hibariya [hibariya!] has joined #ruby-lang
beiter [beiter!] has joined #ruby-lang
snuy [snuy!] has joined #ruby-lang
cleaner72 [cleaner72!c3d41d56@gateway/web/freenode/ip.] has joined #ruby-lang
snuy1 [snuy1!] has joined #ruby-lang
werwolf [werwolf!] has joined #ruby-lang
diegoviola [diegoviola!] has joined #ruby-lang
<mindgame> how do i "escape?" a parenthese used as part of a smiley in a puts statement
<molgrew> what do you mean?
<injekt> why do you need to escape a parenthesis in a string?
<mindgame> puts ":( \n are you sure?"
RomD [RomD!] has joined #ruby-lang
<mindgame> i get an unexpected ':' error
<injekt> no
<injekt> that string is fine
<injekt> you must be doing something else
<shevy> hehe
<shevy> mindgame is doing strange things
<shevy> hmm
<shevy> I have 100 lines of ruby code, in one method ... this ruby code generates a shell script... it is currently not a class. Should I move that logic into its own class?
<mindgame> what am i doing wrong?, what can I do better
<shevy> puts "(y\\n)?
<shevy> you omitted a "
<shevy> you also probably use a bad editor
<mindgame> rubymine
<molgrew> what is that program supposed to do?
<mindgame> nothing just display text
<molgrew> which text exactly?
<shevy> yeah, in my editor the code is highlighted wrongly if there are things like not closed strings
<mindgame> displaying the puts statements and not proceeding further until user types "y"
<manveru> hmm
<shevy> mmh
<manveru> looks ok, i guess?
<manveru> not sure what prompt is
<mindgame> okay. the problem is at 34: the prompt()
<manveru> you didn't show the code for that method
<shevy> it's telepathic code
<shevy> quit being so damn old school manveru!
<mindgame> def prompt
<mindgame> print "> "
<mindgame> end
<mindgame> that's not enough?
<shevy> code in the future isn't actually written anymore
<shevy> mindgame where is the error there?
<manveru> mindgame: you don't flush stdout
<manveru> the output buffer waits until it gets a newline in that case
<mindgame> looks up in pickaxe
toretore [toretore!] has joined #ruby-lang
<injekt> lol
sh1nji [sh1nji!] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
<mindgame> anyone know how to re enable ctrl+z +y in rubymine?
<injekt> mindgame: i doubt many people here use rubymine
<injekt> (hint: it sucks)
<mindgame> more than scite?
<injekt> i dont know, scite sucks too
<mindgame> what would you recommend for windows?
<injekt> i prefer editors that i dont have to fight with
<injekt> vim
<manveru> hehe
<shevy> because vim can be learned in one hour
<manveru> more like 20 minutes
<tobiasvl> vimtutor
<manveru> mastering it takes a decade or so though
<injekt> yeah, never for me
<shevy> it's worth for the 0.57% speed increase over that time span
<injekt> actually it's a magnitude faster in my case
<injekt> I still use textmate a lot too, but nothing comes close to vim when it comes to customizing it to fit your needs
<rue> Except emacs
<mindgame> even installing vim is mindfuck
<shevy> on windows? there is a simple .exe
<mindgame> yeah windows
<shevy> gvim I find very lacking for a GUI editor though
<manveru> lacking?
<manveru> anyway, i'd recommend cream
<manveru> no need to go all hardcore :)
<shevy> yeah, it feels like an afterthought to vim rather than the main idea for it
<oddmunds> shevy: i think that is true
<manveru> dunno, i just turn off the scrollbars, menu, and toolbar, and it feels ok
<shevy> Somehow I felt that copy/pasting with the mouse in gvim is ... odd
BitPuffin [BitPuffin!] has joined #ruby-lang
<mindgame> ctrl pasting is better in my opinion
<injekt> then dont copy/paste with the mouse?
<lianj> yank that shit
<oddmunds> whatever mouse support vim has is also an afterthought
<manveru> did the amiga have a mouse?
<oddmunds> yes
<oddmunds> or, I guess you could buy one
<oddmunds> not sure if I knew anyone that had one
<oddmunds> they mostly used joysticks
<shevy> injekt yeah but then why use gvim in the first place anyway
<rue> For transparency
<shevy> lol
<oddmunds> and to let the window manager decide how it looks?
<oddmunds> (which i assume it does)
<injekt> shevy: as opposed to vim in a terminal?
<shevy> yeah injekt
<manveru> it has prettier colors :)
<injekt> shevy: I use mvim so I can have custom gui settings in my .gvimrc, that is, fonts, better colors
<manveru> and feels a bit more responsive to me
<oddmunds> manveru: if you have shitty colours in your terminal
<shevy> mvim?
<injekt> and my terminal is a set size every time i open it, which is never the size I want to start editing in
<injekt> shevy: macvim
<shevy> I know cream ... but mvim
<oddmunds> what kind of colours are better colours?
<shevy> ah
<mindgame> can someone show me how this STDOUT.flush; prompt() works
<manveru> oddmunds: depends on the theme
<oddmunds> why don't you configure your terminals?
<manveru> mindgame: other way round
<oddmunds> these are things i want to know
<manveru> first print, then flush
<shevy> by default I always think that vim in a terminal has better colours and looks better than gvim :)
<dr0id> Happy Holidays Guise!
<injekt> oddmunds: because I dont design my terminal as my text editor
<shevy> and "feels" faster too
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
<oddmunds> injekt: right, different colours for different uses
<injekt> I use vim in a terminal a lot, but much prefer using mvim
<oddmunds> i have configured my terminal to use the beautifullest of colours and fonts, so i prefer to stick there
<injekt> cool
<manveru> oddmunds: likewise
<injekt> same for me in mvim
BitPuffin [BitPuffin!] has joined #ruby-lang
<manveru> just a little more... and my editor will be ready :)
<injekt> im too fickle :)
<manveru> i went with the solarized hype a while ago
<injekt> i did too
<mindgame> paying off yet?
BitPuffin [BitPuffin!] has joined #ruby-lang
<oddmunds> also, and probably more importantly, i usually code over ssh, so i don't have much of a choice
<manveru> oddmunds: likewise
<erikh> awestruct looks neat, but I can't help but think it's *very* memory-hungry
<injekt> interesting
<dr0id> so no one wants to say me happy holidays in return ... really??!!?
<injekt> dr0id: bah humbug!
<mindgame> feliz holidays
<injekt> erikh: bin/awestruct - $: << File.dirname(__FILE__) + '/../lib' :( :( :(
<erikh> no shift later?
<shevy> dr0id no holidays, get to work more instead!!!
<oddmunds> dr0id: i was slow to figure out that Guise was not a specific person. Happy Holidayss!
<manveru> why do it at all?
<injekt> ^
<injekt> and no i dont think so
<injekt> wow their use of optparse is intense
<dr0id> shevy: :D
<injekt> they need themselves some slop!
<manveru> <3 OptionParser :)
<erikh> it's still a nice way to pull in a lot of files from inner libdirs
<erikh> dunno
<dr0id> ok, I'll work harder this holiday, especially teh christmas eve
<erikh> maybe this is one of those things I"m going to feel old on
<injekt> erikh: lib is already in $LOAD_PATH so I dont see why people shift it in
<manveru> erikh: is there any reason to not use require_relative for new libs?
<erikh> manveru: 1.8
<erikh> injekt: not necessarily
<injekt> i wouldn't use require_relative either
<injekt> erikh: if it's setup properly it should be
<manveru> ok, then that's just me :)
<erikh> if it's a *rubygem* it should be
<injekt> yeah, im talking about gem libraries specifically, sorry
<erikh> but I'm nitpicking, and you're largely correct.
<erikh> anyhow it does look pretty neat.
<erikh> love how they packed all that semantic equivalence into (more or less) inheritance
<erikh> very elegant
<injekt> I think im getting old and grumpy with code
<shevy> hmm
<shevy> the idea of awestruct is to treat the HTML like objects?
krz [krz!~foobar@] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
<ksinkar> while using fastercsv how do we append to a file object?
<erikh> shevy: basically it's treating the data as inheritable as opposed to the structure
<erikh> well the structure too
<erikh> meh
<erikh> injekt: it's a phase. 3 years from now, you'll look at the noisiest line noise and simply won't give a fuck
<erikh> unless you're zenspider
<erikh> then you'll be all like "KILL ALL THE NOISE"
<injekt> :P
workmad3 [workmad3!] has joined #ruby-lang
<injekt> wow i really cant get much work done on my internet connection :(
Kanolesic [Kanolesic!] has joined #ruby-lang
<mindgame> no way
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
<mindgame> i had to deal with a 230kb net connection,
<mindgame> after a 5gb cap; fuck indian netcards
<injekt> it just took me an hour to download a 6mb pdf
<Mon_Ouie> IRC is taking all the bandwidth
<injekt> :)
<mindgame> what is the exit code when stuck in a program
<shevy> it's the world wide wait after all
<erikh> the only thing I agree with spolsky on -- the only thing -- is that he believes good code is ugly, because it has actual bugfixes applied to it.
<injekt> hah
<injekt> mindgame: what?
<shevy> mindgame perhaps exit 2? exit 666?
<erikh> mindgame: if a program is stuck it usually enters an i/o wait or alternatively a zombie state in ps (D or Z)
<erikh> stuck is the antithesis of exit
<shevy> hehe
chrismcg_ [chrismcg_!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
<erikh> man that red bull really worked
<mindgame> hold up I will show you
<manveru> erikh: ps on windows?
<erikh> meh
<manveru> :)
<erikh> well there's the task manager, and I think there's a ps-alike (but obviously not the same)
<manveru> well, given that windows doesn't have fork, i don't think it has zombies...
<manveru> dunno if that sentence even makes sense
<Kuukunen> injekt: neener neener
<rue> Stupid DNA, I can only get ~80-90 Mbps
<erikh> I pay an absurd amount for half that
<erikh> stupid fucking america
<erikh> and nowhere near the upload
<injekt> Kuukunen: wow fuck you:(
<erikh> manveru: are you sure he's on windows?
<injekt> he said he was
<erikh> oh, ok
<erikh> I'll stay out of it then :)
<manveru> but hey, it's only 3G... so i can't complain too much
<injekt> dude mine was 0.11
<injekt> stop your sad face
<manveru> 0.11?
<manveru> what is that? 64k?
ksinkar [ksinkar!~ksinkar@] has joined #ruby-lang
<manveru> 500ms...
<injekt> 'slower than 94% of gb'
<erikh> pidgeons :)
<erikh> they're flying out of his lines and back into them
<injekt> i do live on a farm
<injekt> in the middle of nowhere
<manveru> no wonder irc takes up all your bandwidth
<injekt> :P
<manveru> mindgame: you should put the $stdout.flush into the prompt method
<manveru> so you don't forget to use it, like you do :)
<mindgame> I want to add it such that if they say y, at the second prompt, y executes
<mindgame> ok
<mindgame> i tried using a loop to make saying n go nowhere, then using a break statement for ==y to get it to execute y and end but it murphed
<erikh> you could use the return value of n for that
<erikh> oh I misread
<erikh> this is where I put down irc for a bit
DotMH [DotMH!] has joined #ruby-lang
DotMH [DotMH!] has quit [#ruby-lang]
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
snuy [snuy!] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@] has joined #ruby-lang
flip_digits [flip_digits!] has joined #ruby-lang
DotMH [DotMH!] has joined #ruby-lang
DotMH [DotMH!] has quit [#ruby-lang]
<Indian> lo
tomzx [tomzx!] has joined #ruby-lang
ramonmaruko1 [ramonmaruko1!~marco@] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@] has joined #ruby-lang
petercooper [petercooper!~petercoop@] has joined #ruby-lang
towski [towski!] has joined #ruby-lang
Kanolesic [Kanolesic!] has joined #ruby-lang
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
RomD [RomD!] has joined #ruby-lang
Jake232 [Jake232!] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
spuk [spuk!~spuk@] has joined #ruby-lang
jmeeuwen [jmeeuwen!] has joined #ruby-lang
csherin [csherin!~csherin@] has joined #ruby-lang
csherin_ [csherin_!~csherin@] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
snuy1 [snuy1!] has joined #ruby-lang
krz [krz!~foobar@] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
spuk [spuk!~spuk@] has joined #ruby-lang
rippa [rippa!] has joined #ruby-lang
tcurdt [tcurdt!] has joined #ruby-lang
krz [krz!~foobar@] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
yfeldblum [yfeldblum!] has joined #ruby-lang
Spooner [Spooner!] has joined #ruby-lang
snuy1 [snuy1!] has quit [#ruby-lang]
sh1nji [sh1nji!] has joined #ruby-lang
vesan [vesan!] has joined #ruby-lang
vesan [vesan!] has joined #ruby-lang
workmad3 [workmad3!] has joined #ruby-lang
vesan [vesan!] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
paddor [paddor!] has joined #ruby-lang
dv310p3r [dv310p3r!] has joined #ruby-lang
dr0id [dr0id!~andy@unaffiliated/dr0id] has quit [#ruby-lang]
Austin__ [Austin__!~austin@] has joined #ruby-lang
Neil__ [Neil__!~neil@] has quit ["Leaving..."]
mantono [mantono!~mantono@] has joined #ruby-lang
datanoise [datanoise!] has joined #ruby-lang
outoftime [outoftime!~mat@] has joined #ruby-lang
dhruvasagar [dhruvasagar!~dhruvasag@] has joined #ruby-lang
workmad3 [workmad3!] has joined #ruby-lang
<outoftime> anybody know if there is a more performant alternative to the built-in Ruby URI class?
<erikh> yes, raggi_ has one you just need to get him to convince him to share it
<erikh> err or just convince him instead of trying to get him to convince himself
<erikh> my english sucks
<outoftime> erikh: the above in response to me?
<erikh> yes
<outoftime> erikh: interesting, I shall endeavor.
<outoftime> raggi_: how can I make this worth your while?
scampbell [scampbell!] has joined #ruby-lang
<erikh> building a faster URI parser isn't extremely hard
<erikh> building a *correct* parser is a whole different story
<outoftime> erikh: it's actually the performance of that is of particular concern at this point
<outoftime> erikh: I'm familiar with Addressable, which from what I understand is a more correct, but less fast, implementation
<outoftime> it seems like the sort of area where a C extension might go a long way
<erikh> yeah, not familiar with that one
<erikh> eh, I imagine apr has all the tooling already for this
<erikh> but apr is probably bigger than you want
<outoftime> yeah
<erikh> acutally it doesn't, it's strictly portability methods
retro|cz [retro|cz!] has joined #ruby-lang
<outoftime> interesting -- a quick benchmark indicates that URI.parse is considerably faster than to output the same URI object
<erikh> unsure what that really proves
<erikh> .build could be calling .parse as a sanity check, lots of things could be going on there
<outoftime> erikh: it proves that if I want to build URIs quickly, I should use string-concatenation and #parse
<outoftime> s/proves/suggests
<erikh> if you want to build URIs *quickly* you should use sprintf and ignore conventions
<erikh> correct is another matter
<erikh> pedantic, yes. important, yes.
<outoftime> erikh: well I'm monkey-patching an existing library which expects URI objects
<outoftime> erikh: so yes, sprintf, but then URI.parse
<erikh> gotcha
<erikh> well if that does what you need...
<outoftime> erikh: I'm not too concerned about correctness as it's just building URIs to talk to a particular internal HTTP service
<outoftime> so the unexpected is not to be expected in terms of far-out URI patterns
<erikh> well, heh, lots of software performance is about weighing correct against "good enough"
<outoftime> amen to that.
init[1] [init[1]!~dlevel@] has joined #ruby-lang
<rue> Do you really need to be building URLs at all?
<rue> And especially non-cached ones?
<outoftime> rue: yeah, the URLs are resource identifiers for Riak keys
<outoftime> rue: so a new URI for each key we need to deal with; memoization isn't really an option
<rue> *Entirely* new? Not just http://yay/foobar/<key>?
dejongge [dejongge!] has joined #ruby-lang
<outoftime> rue: I see your point. no, not entirely new. optimizing around that fact would probably involve heavier monkey-patching than I really want to do at this point, though.
<rue> Hm, that's possible
<rue> I'd definitely go with just String#<<, #+ and so on for simple cases, maybe even File.join
<outoftime> rue: absolutely, I'd do that if I were in complete control of this code
<rue> Might be as much as an OOM difference.
<outoftime> rue: right now it's spending almost as much time building URIs as it is sending data to them
<outoftime> rue: and Riak is not known for its write performance
<outoftime> rue: so an OOM difference seems quite plausible.
Natch| [Natch|!~natch@] has joined #ruby-lang
Austin__1 [Austin__1!~austin@] has joined #ruby-lang
* imperator runs through ruby-prof
Mchl [Mchl!] has joined #ruby-lang
saLOUt [saLOUt!] has joined #ruby-lang
<imperator> dunno, seems pretty performant to me
<imperator> hm, on the network graphs on github, i can't seem to mouseover individual commits
jmontross [jmontross!~Adium@] has joined #ruby-lang
<rue> That's a fairly significant difference, if is the bottleneck
<rue> outoftime: ^
<Indian> any one saw banisted the dude from newzland
<rue> Yes, banisted dude
<outoftime> rue: yes it is. I noticed actually that is much more performant than
<injekt> lol
<outoftime> rue: looks like the URI::Util::make_components_hash method is quite slow, I guess just trying to deal with all manner of different input types.
<imperator> rue, true, but presumably there's validation going on :)
<imperator> how fast is fast enough?
<rue> I'm assuming this is dire straits as C extensions were brought up and outoftime isn't a complete noob ;)
_rockbot_ [_rockbot_!] has joined #ruby-lang
<outoftime> yep -- as I mentioned, a significant proportion of the total time it takes to write a document to Riak is just constructing the URL. That just ain't right.
confounds [confounds!] has joined #ruby-lang
<outoftime> that said, right now I'm just monkey-patching the low hanging fruit; I'll try and come up with a real patch to the library later that addresses the problem closer to the root. it seems that switching to removes this particular bottleneck
* imperator looks at available uri gems
savage- [savage-!~savage-@] has joined #ruby-lang
<_rockbot_> best books/tools/sources through which to learn ruby: go!
<rue> Programming
<bougyman> a mentor
<imperator> rue
<outoftime> _rockbot_: what's your background?
<injekt> corundum: books?
<corundum> see "poignant guide" or "pickaxe" or
* imperator finds uri_parser, which is a c extension that wraps chromium's url lib, but i don't think it has a builder
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
<outoftime> imperator: interesting...
<outoftime> imperator: thanks!
corecode [corecode!] has joined #ruby-lang
<rue> imperator: There aren't that many
Natch| [Natch|!~natch@] has joined #ruby-lang
<imperator> outoftime, i started with a gem search -r -d uri_
looopy [looopy!] has joined #ruby-lang
<outoftime> imperator: brilliant! : )
<_rockbot_> outoftime: I'm a roboticist, know python, matlab, c/c++, etc
<rue> Mostly the stdlib is enough, plus probably 50% just use string building anyway
<outoftime> _rockbot_: I'd go with the Pickaxe then.
<injekt> _rockbot_: if you know those, just pick it up and start
<injekt> Gah pickaxe :(
<outoftime> what's wrong with the pickaxe?
<injekt> dont get me started
<outoftime> I suppose I won't, then : )
<rue> The Ruby Programming Language, or I hear Eloquent Ruby is, despite the idiotic name, rather good
andrewhl [andrewhl!] has joined #ruby-lang
<outoftime> I haven't really opened the Pickaxe since being new to Ruby
<imperator> _rockbot_, use arduino?
<outoftime> so maybe it's full of inaccuracies that I just didn't notice at the time
<outoftime> I do vaguely remember it saying that a for loop is identical to an #each call...
<_rockbot_> imperator - funny enough, no, actually
<injekt> outoftime: i learned mostly from the pickaxe too, then read it again once i knew what i was doing and was so glad i didn't take too much from it
<injekt> it's an awesome reference
<outoftime> injekt: ten four
* imperator had the original pickaxe!
<imperator> <- ruby hipster
<injekt> I used the ruby way (original) a lot, too
<rue> corundum: no, books is "The Ruby Programming Language", "Eloquent Ruby", "Programming Ruby 1.9” (‘Pickaxe’) or see
<corundum> okies!
havenn [havenn!] has joined #ruby-lang
<_rockbot_> awesome, thanks guys!
laszlokorte [laszlokorte!] has joined #ruby-lang
<rue> corundum: intermediate books is “Ruby Best Practices", “Design Patterns in Ruby”, “Exceptional Ruby”, “The Ruby Way”, or see
<corundum> okay then :)
<injekt> oh come on rue
<injekt> who's gonna remember that key
queeway [queeway!] has joined #ruby-lang
<rue> I will
<injekt> heh
<injekt> :)
vmatiyko [vmatiyko!~vmatiyko@] has joined #ruby-lang
<injekt> corundum: beginning ruby?
<corundum> beginning ruby is
<savage-> don't forget Ruby Metaprogramming by Paolo Palotta!
vmatiyko [vmatiyko!~vmatiyko@] has quit [#ruby-lang]
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!] has joined #ruby-lang
thone [thone!] has joined #ruby-lang
mndoci [mndoci!] has joined #ruby-lang
igotnolegs [igotnolegs!] has joined #ruby-lang
yorickpeterse [yorickpeterse!~yorickpet@pdpc/supporter/professional/yorickpeterse] has joined #ruby-lang
workmad3 [workmad3!] has joined #ruby-lang
Roujo [Roujo!] has joined #ruby-lang
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
looopy [looopy!] has joined #ruby-lang
bglusman [bglusman!] has joined #ruby-lang
Steppenwolf [Steppenwolf!] has joined #ruby-lang
<outoftime> shit.
<outoftime> oops! sorry
<outoftime> totally did not intend to type that there : 0
sepp2k [sepp2k!] has joined #ruby-lang
guns [guns!] has joined #ruby-lang
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
<shevy> lol
dhruvasagar [dhruvasagar!~dhruvasag@] has joined #ruby-lang
havenn [havenn!] has joined #ruby-lang
looopy [looopy!] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
Heimidal [Heimidal!] has joined #ruby-lang
pigdude [pigdude!] has joined #ruby-lang
pigdude [pigdude!] has quit [#ruby-lang]
looopy [looopy!] has joined #ruby-lang
benanne [benanne!] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
diegoviola [diegoviola!] has joined #ruby-lang
cyri_ [cyri_!] has joined #ruby-lang
havenn [havenn!] has joined #ruby-lang
datanoise [datanoise!] has quit [#ruby-lang]
vmatiyko [vmatiyko!~vmatiyko@] has joined #ruby-lang
vmatiyko [vmatiyko!~vmatiyko@] has quit [#ruby-lang]
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
AlHafoudh [AlHafoudh!] has joined #ruby-lang
davehimself [davehimself!~davehimse@] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
io_syl [io_syl!~io_syl@unaffiliated/steph021] has joined #ruby-lang
S2kx [S2kx!] has joined #ruby-lang
srbaker [srbaker!~srbaker@] has joined #ruby-lang
gjastrab [gjastrab!] has joined #ruby-lang
gjastrab [gjastrab!] has quit [#ruby-lang]
Weems [Weems!] has joined #ruby-lang
Weems [Weems!~the@unaffiliated/weems] has joined #ruby-lang
io_syl [io_syl!~io_syl@unaffiliated/steph021] has joined #ruby-lang
Jake232 [Jake232!] has joined #ruby-lang
burgestrand [burgestrand!] has joined #ruby-lang
Codif [Codif!] has joined #ruby-lang
<raggi_> outoftime: wrt, just use strings dude
<raggi_> objectified uris for building is a total waste of time, the commonly used spec is so damn trivial
<outoftime> raggi_: yeah, agreed -- however I'm monkey-patching a library that expects to be working with URI objects, so I still need to find the least-inefficient way to get those objects
<outoftime> raggi_: which appears to be
<raggi_> oh, i see
<raggi_> :(
<outoftime> raggi_: sad indeed. but still, definite performance boost going from URI.merge to
<raggi_> it's not finished, i did it from spec to see how much it would take:
<raggi_> erikh started using it for somehting a while back, and it works well for that use case
<raggi_> i just need to implement a to_s and so on really
<raggi_> and i guess fix the port/scheme mismatch
<outoftime> raggi_: nice
<raggi_> 1.8.7+, it wont' work with 1.8.6
nuclearsandwich [nuclearsandwich!] has joined #ruby-lang
<raggi_> oh, also, n.b. the examples from rfc2732 have been altered for correctness.
tla [tla!] has joined #ruby-lang
<raggi_> *eyeroll*
heppy [heppy!] has joined #ruby-lang
phlipper [phlipper!~phlipper@] has joined #ruby-lang
bousquet [bousquet!~bousquet@] has joined #ruby-lang
Mon_Ouie [Mon_Ouie!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby-lang
Pip_ [Pip_!~Pip@unaffiliated/pip] has joined #ruby-lang
Kanolesic [Kanolesic!] has joined #ruby-lang
corn_man [corn_man!kvirc@unaffiliated/cornman] has joined #ruby-lang
<josh9> rue: i really loved 'Design Pattern in Ruby' and now reading 'Eloquent Ruby' by the same guy - Russ Olsen
<josh9> anyone read 'Exceptional Ruby' and cas share his opinion?
TheMoonMaster [TheMoonMaster!~TMM@reddit/operator/themoonmaster] has joined #ruby-lang
savage-_ [savage-_!~savage-@] has joined #ruby-lang
savage-_ [savage-_!~savage-@] has joined #ruby-lang
ttilley [ttilley!] has joined #ruby-lang
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
havenn [havenn!] has joined #ruby-lang
sodani1 [sodani1!] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
<whitequark> anyone knows how to get Haml's AST?
<whitequark> I don't see a public interface in the gem
Mon_Ouie [Mon_Ouie!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby-lang
havenn [havenn!] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@] has joined #ruby-lang
Swimming_Bird [Swimming_Bird!~textual@] has joined #ruby-lang
Natch| [Natch|!~natch@] has joined #ruby-lang
guns [guns!] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
petercooper [petercooper!~petercoop@] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@] has joined #ruby-lang
solars [solars!] has joined #ruby-lang
<JosephRuby> is there a gem to port 1.9 regex methods to 1.8?
curtism [curtism!] has joined #ruby-lang
<jensn> I don't want to sound negative or anything, but not using 1.9 is bad™.
<jensn> If you need the features of 1.9, you probably want to upgrade for all the other good reasons too.
urbanmonk [urbanmonk!] has joined #ruby-lang
postmodern [postmodern!] has joined #ruby-lang
<Jake232> Is there something wrong with the syntax of this wrong.
<Jake232> rescue Wordpressto::Error => e
<Jake232> puts e.message
<Jake232> end
<Jake232> It doesnt output anything, and I'm pretty sure it should be
<JosephRuby> jensn: would like to, but i am not project lead
lsegal [lsegal!] has joined #ruby-lang
<samuelkadolph> Jake232: That code on its own doesn't do anything.
<Jake232> samuelkadolph: I know that, but I mean
<Jake232> If something inside the begin blog, causes that error
<Jake232> Should that display the message?
<samuelkadolph> What do you think?
<mindgame> samuelkadolph: your name reminds me of morpheus
<jensn> JosephRuby: At some point, some of the new stuff was available in the oniguruma gem. I think you need to install oniguruma first though.
<JosephRuby> jensn: thanks Ill look that way
<Jake232> samuelkadolph: I figured it should, and that I was over lookign something
<Jake232> fixed it now anyway
<jaimef> this seems too long puts "first: #{list_vdi_for_vm(name).split("\n\n").select{ |l| l.match(": hda") }.to_s.split("\n").select{ |l| l.match("vdi-uuid") }.to_s.split().last}"
walbert1 [walbert1!] has quit [#ruby-lang]
<mindgame> is Rdoc the same as the index in pickaxe
<mindgame> or a fuller index?
hebz0rl [hebz0rl!~hebz0rl@] has joined #ruby-lang
<josh9> anyone is using the jenkins gem? i am not able to install it -
<zenspider> mindgame: what do you mean?
[esn] [[esn]!] has joined #ruby-lang
[esn] [[esn]!] has quit [#ruby-lang]
<zenspider> josh9: this came up the other day. take it to #rubygems and bug qrush about it
<josh9> zenspider: will do. thanks
<jaimef> anything cleaner than v.split("\n").first.to_s.split().last ?
<zenspider> to_s ?
<zenspider> why are you calling to_s on a string you just split?
<yorickpeterse> v.split("\n")[0].split[-1]
<yorickpeterse> :]
<yorickpeterse> Never really got the advantage of #first and #last
<zenspider> that's entirely equivalent and not any cleaner
<yorickpeterse> It's shorter :)
<zenspider> so?
<yorickpeterse> and it doesn't call #to_s on a string
<zenspider> wow
<zenspider> jaimef: v[/\w+$/]
<jaimef> not sure what I am smoking today
<jaimef> zenspider: thanks. I really have to become more proficient at using regexp
confounds [confounds!~confounds@] has joined #ruby-lang
<jaimef> v[/\w+-\w+-\w+-\w+-\w+$/] given it's a uuid
<josh9> is it possible to run minitest by line number?
<zenspider> josh9: no, assuming I understand your question
<josh9> zenspider: in rspec you can say :9 and this line will get run
<zenspider> jaimef: v[/[\w-]+/] will do too
<cout> I can't say that question has ever crossed my mind before
<zenspider> josh9: so use rspec
<zenspider> minitest won't ever try to meet feature parity with rspec. it's never been a goal
<zenspider> in fact, I'd say it's an anti-goal
<jaimef> zenspider: it cuts off on -
<jaimef> so I get the last oid on the uuid only
<zenspider> jaimef: look again
<josh9> zenspider: i love minitest minimalistic approach and speed, so i don't think i'll switch anytime soon
<jaimef> ahh extras nice
<mindgame> I get an unexpected end error. Also how are my indentations & organization?
<zenspider> mindgame: use your text editor's ability to fix indentation. then your missing end should also be obvious
shajith [shajith!] has joined #ruby-lang
shajith [shajith!] has joined #ruby-lang
Dreamer3 [Dreamer3!] has joined #ruby-lang
shajith [shajith!] has joined #ruby-lang
<jaimef> stack level too deep. Tail recursive optimized my ass
mksm [mksm!] has joined #ruby-lang
dejongge [dejongge!] has joined #ruby-lang
<zenspider> ruby doesn't claim to be tail recursive
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
canton7 [canton7!~canton7@] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
Axsuul [Axsuul!] has joined #ruby-lang
<rue> Does so too, it says so right there on the box
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
Kanolesic [Kanolesic!] has joined #ruby-lang
Codif_ [Codif_!] has joined #ruby-lang
voker57 [voker57!~voker57@] has joined #ruby-lang
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@] has joined #ruby-lang
<rue> Ruby 98, 16-bit edition
<yorickpeterse> Now with a free copy of Norton Anti virus
<injekt> hehe
QaDeS [QaDeS!] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
sh1nji [sh1nji!] has joined #ruby-lang
ascarter [ascarter!] has joined #ruby-lang
hahuang65 [hahuang65!] has joined #ruby-lang
gloriaC991 [gloriaC991!] has joined #ruby-lang
<gloriaC991> what's the best-practice way of checking if an object is Hash-like? i don't wanna test if it's actually a hash or not, just if it will behave as expected when i call things like obj[:key]
srbaker [srbaker!~srbaker@] has joined #ruby-lang
<injekt> gloriaC991: obj.respond_to?(:keys) :each_key, :fetch
<injekt> depends how you want it to be implemented
<gloriaC991> injekt: gotcha
<gloriaC991> thanks
<gloriaC991> oh, even better
<gloriaC991> obj.respond_to? :[]
<injekt> gloriaC991: expect an Array responds to :[] too, if that's okay then sure
<gloriaC991> true
<gloriaC991> i think array also responds to fetch though
<injekt> yep
<injekt> back to how you want to use the behaviour, if you're using duck typing, it's usually for that reason
<gloriaC991> fair enough
<gloriaC991> thanks
<injekt> a common one is to check if an object responds to :call, that way you can have a proc, block, or your own custom class with a call method, for example
<injekt> wow lag
<gloriaC991> interesting
sodani1 [sodani1!] has quit [#ruby-lang]
<injekt> gloriaC991: for example
<injekt> you get the point :)
<gloriaC991> yep
<gloriaC991> thanks P)
<gloriaC991> :)
<whitequark> gloriaC991: maybe try .respond_to? :to_hash ?
<injekt> i like that one
<whitequark> not exactly what you need, but at least it has well-defined semantics
<gloriaC991> ooh
<gloriaC991> <3 that one
<injekt> I use the :to_str, and :to_ary for string/arrays too usually
<whitequark> yeah, implicit coercing methods. they're often overlooked
<gloriaC991> nice
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
<whitequark> by the way
jasox [jasox!~jasox@] has joined #ruby-lang
ryanf [ryanf!~revfitz@] has joined #ruby-lang
<whitequark> can anyone suggest a good name for a ruby project?
<whitequark> I'm out of ideas
<gloriaC991> what does it do?
<whitequark> gloriaC991: looking at gem names, I think that purpose does not influence the name at all :D
<gloriaC991> hahah i like it to at least have a small influence, even if it's a stretch
<whitequark> it's an attempt at a statical ruby compiler
<whitequark> kind of
<gloriaC991> thinking
<jensn> static-ruby?
<gloriaC991> BORING
<zenspider> whitequark: have you looked at your competition?
<gloriaC991> yeah i can't think of anything good off the top of my head either
<whitequark> zenspider: druby. jruby (again, kind of). variants of ruby2c. I don't know any other ones
<whitequark> mine is not going to convert to C, and I'm not that sure about the success to occupy another one of [a-z]ruby
shaman42 [shaman42!] has joined #ruby-lang
<zenspider> ruby2* - I've done smalltalk, rubyc, ansic, prolly a couple I've forgotten about.
<zenspider> there was one from a ways back.... rubyextc or something like that
<whitequark> this namespace is already confusing enough I'd say
cyndis [cyndis!] has joined #ruby-lang
<zenspider> ok. I gotta go pick up fosters... later
towski [towski!] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
io_syl [io_syl!~io_syl@unaffiliated/steph021] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
gandaro [gandaro!gandaro@wikipedia/Gorlingor] has joined #ruby-lang
gandaro [gandaro!gandaro@wikipedia/Gorlingor] has quit [#ruby-lang]
lele [lele!] has quit ["Leaving"]