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
Defusal has joined #ruby-lang
hzlocky has joined #ruby-lang
<hzlocky> Guys, I want to mix into true, false, nil method [], is it sounds rational?
<slyphon> no
<slyphon> that sounds like a bad idea
<hzlocky> why?
<slyphon> because those things do not respond to []
<slyphon> and it will break duck typing
<hzlocky> yes, cause it is respond to [], I am sure it is ok
<hzlocky> why is it break duck typing?
<slyphon> those things do not respond to [] normally
<hzlocky> yep
<slyphon> unless you have an incredibly good reason
<slyphon> i would not do that
<hzlocky> Basically
<hzlocky> I am writing kind of configuration solution in my code
<slyphon> those are like changing fundamental units of ruby
<hzlocky> flexible configuration loaded from yaml
<slyphon> don't change the way things work in every included library for your configuration class
<hzlocky> user can invoke configuration['level1_yaml']['level2_yaml']
<slyphon> there are other methods for doing that
<hzlocky> and even if level1_yaml it is not exists it would return true
<slyphon> no, your configuration class should have []
<slyphon> and you should return a hash-like thing that returns something that responds to [] without dying
<hzlocky> but even both level doesnt exists, I want configuration['level1_yaml'] as well as configuration['level1_yaml']['level2_yaml'] returns true
<slyphon> yeah, so, you can do that
<slyphon> without resorting to hacking nil
<hzlocky> but how?
wmoxam has joined #ruby-lang
<slyphon> what do you think configuration is above?
<slyphon> a Hash?
<hzlocky> configuration is Class
<slyphon> more or less
<hzlocky> which has #[]
<slyphon> ook, but provides hash-like access
<slyphon> so if the argument to #[] isn't configured, you don't have to return nil
<slyphon> you can return some other object
<slyphon> that responds to []
<slyphon> and probably should be falsy
andrewhl has joined #ruby-lang
<slyphon> one sec
andrewhl has joined #ruby-lang
hzlocky_ has joined #ruby-lang
<hzlocky_> configuration is Class
<hzlocky_> which has #[]
<slyphon> hzlocky_: lemme code up an example
<drbrain> ReinH: zenspider wants to know if apt-get is Spock
nif has joined #ruby-lang
rdavila has joined #ruby-lang
boxmo has joined #ruby-lang
<ReinH> drbrain: ?
<ReinH> hahaha
<zenspider> haha
<ReinH> that quote is from YEARS ago
<ReinH> lulz
<ReinH> I don't even remember when it was added
<ReinH> I found the page in a google search and was like "wtf that's ME"
<drbrain> ha!
<hzlocky_> the problems, that configuration['level1']['level2'] is interpreted as invoke of [][] method
<slyphon> no
<slyphon> wrong
<slyphon> hzlocky_: ^^
<slyphon> gotta go see what's wrong w/ my 3 year old
<slyphon> (won't go to bed, dammit)
<zenspider> slyphon: it's THREE... that's what is wrong
<hzlocky_> slyphon: nice code, but I want BogusValue to works absolutely like TrueClass(or FalseClass or NilClass)
<zenspider> hzlocky_: what you want to do is nonsensical
<zenspider> you want conf[k1] to return true and conf[k1][k2] to return true
<hzlocky_> yep
<zenspider> but the latter depends on the former to return something that will accept the #[] method
<zenspider> and that just ain't happening w/o you severely breaking stuff
<hzlocky_> 1-st phrase - yes
<zenspider> now... if you accept conf[k1] to return something TRUTHY... that's another matter
<zenspider> because truthy is much better and bigger than true
<zenspider> you could do conf[k1, k2] instead
drumond19 has joined #ruby-lang
<hzlocky_> thats looks ugly
<zenspider> not my problem
<zenspider> I'm telling you what your options are
macmartine has joined #ruby-lang
ryanf has joined #ruby-lang
gregf has joined #ruby-lang
<zenspider> quick! someone write a parser for the output of ruby --dump parsetree
hackingoff has joined #ruby-lang
machine2 has joined #ruby-lang
<slyphon> it's not ruby --load parsetree ?
<slyphon> lame!
shevy has joined #ruby-lang
jolohaga has joined #ruby-lang
<zenspider> you fuckers... fine. I'll write it myself
headius has joined #ruby-lang
jperry has joined #ruby-lang
headius has joined #ruby-lang
slimfit has joined #ruby-lang
<erikh> ha
dhruvasagar has joined #ruby-lang
<zenspider> it's actually rather nice. I've got it munging it into yaml
havenn has joined #ruby-lang
gnufied has joined #ruby-lang
<erikh> cool
<erikh> today has been official monthly procrastination day
<erikh> hoping my brain will kick into gear later tonight.
senthil has joined #ruby-lang
robbyoconnor has joined #ruby-lang
headius has joined #ruby-lang
skipper has joined #ruby-lang
jtoy has joined #ruby-lang
setmeaway2 has joined #ruby-lang
t has joined #ruby-lang
andrewhl has joined #ruby-lang
gnufied has joined #ruby-lang
crudson has quit [#ruby-lang]
havenn has joined #ruby-lang
RORgasm has joined #ruby-lang
t_ has joined #ruby-lang
setmeaway has joined #ruby-lang
<Asher> do rackup apps usually decide their root (for loading config/environment files, etc.) by way of the config.ru file?
shtirlic has joined #ruby-lang
neoesque has joined #ruby-lang
<erikh> yes
<Asher> cool thanks
jxie has joined #ruby-lang
tris has joined #ruby-lang
Joeysomo has joined #ruby-lang
hackingoff has joined #ruby-lang
RubyRedGirl has quit [#ruby-lang]
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
mistym has joined #ruby-lang
dhruvasagar has joined #ruby-lang
dhruvasagar has joined #ruby-lang
Joeysomo has joined #ruby-lang
fukushima has joined #ruby-lang
slimfit has joined #ruby-lang
wycats_ has joined #ruby-lang
gix has joined #ruby-lang
Asher has joined #ruby-lang
<imperator> erikh, why not submit before the feature freeze? or do you mean there's a freeze now?
spuk has joined #ruby-lang
<erikh> I dunno. I talked to drbrain and he suggested I waited.
<Xzyx987X> hmm... is there any way to get ruby to let me do this?: "def password==(password)"
jxie has joined #ruby-lang
<Xzyx987X> I know I could create a new class to handle the "==" operator, but it really seems like a weird approach in this case
<erikh> yeah, that's the only thing I can think of
jxie has joined #ruby-lang
<Xzyx987X> :/ I guess I'll just have to create a new class just for the password hash then
<erikh> you could create another method, "equals_hash" or some business
<erikh> might be simpler than trying to work with operators.
<imperator> drbrain, why wait?
headius has joined #ruby-lang
<Xzyx987X> that's true I guess, but the inconsistency bugs me :P anyway, I'm not sure why we can't do "def object==(object)" in the first place. seems like a logical thing to have the ability to do
surfprimal has joined #ruby-lang
<bnagy> it's not logical
<bnagy> ifg I see password=='blah' I am expecting it to be a call to == on a password object
<bnagy> not a method called 'password=='
<bnagy> also, stylistically (and this is subjective) I don't like the idea of using == when you're not testing equality, I'd suggest validate, or hash_matches? or something - like erikh said above
gnufied1 has joined #ruby-lang
kashyapkmbc has joined #ruby-lang
zz_skinny_much has joined #ruby-lang
ericmuyser has joined #ruby-lang
dr0id has joined #ruby-lang
Fullmoon has joined #ruby-lang
jxie has joined #ruby-lang
RORgasm has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
slimfit has joined #ruby-lang
tonesfrommars has joined #ruby-lang
rohit has joined #ruby-lang
travisjeffery has joined #ruby-lang
paul0 has joined #ruby-lang
<postmodern> working on adding man-pages to my project
<postmodern> i noticed bundler runs groff and $PAGER/`lass -R` to render the man pages
<postmodern> wondering why not simply do system("man","./man/foo.1")
<zenspider> does anyone have ANY clue why ruby 1.9 has an AST difference between proc { |a| } and proc { |a,| } ???
deobald has joined #ruby-lang
imperator has quit ["Leaving"]
krazyj has joined #ruby-lang
<krazyj> any users of RGeo in here?
chimkan has joined #ruby-lang
<postmodern> zenspider, you know more about Ruby than I, but it seems "a," somehow results in a "nil" in the parse tree, otherwise it's a "null"
<zenspider> yeah. I'm confused as to what the difference actually is... and why
bojicas has joined #ruby-lang
rohit has joined #ruby-lang
paul0 has joined #ruby-lang
brushbox1 has joined #ruby-lang
gnufied1 has joined #ruby-lang
gouthamvel has joined #ruby-lang
gouthamvel has joined #ruby-lang
gnufied1 has joined #ruby-lang
chimkan___ has joined #ruby-lang
harikt has joined #ruby-lang
harikt has quit [#ruby-lang]
chimkan____ has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
chimkan_ has joined #ruby-lang
chimkan_ has joined #ruby-lang
brianpWins has joined #ruby-lang
t has joined #ruby-lang
gnufied has joined #ruby-lang
macmartine has joined #ruby-lang
Asher has joined #ruby-lang
replore_ has joined #ruby-lang
yxhuvud has joined #ruby-lang
spuk has joined #ruby-lang
bryanl has joined #ruby-lang
JohnBat26 has joined #ruby-lang
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
mephux has joined #ruby-lang
gokul has joined #ruby-lang
gnufied1 has joined #ruby-lang
paul0 has joined #ruby-lang
RORgasm has joined #ruby-lang
boxmo has joined #ruby-lang
gnufied has joined #ruby-lang
kitallis has joined #ruby-lang
macmartine has joined #ruby-lang
dhruvasagar has joined #ruby-lang
<erikh> bwahaha
<erikh> # Ruby lexer adapted from irb.
<erikh> #
<erikh> # The internals are not documented because they are scary.
pygmael has joined #ruby-lang
x0F_ has joined #ruby-lang
ryanf has joined #ruby-lang
<zenspider> erikh: what's that from?
<Asher> zenspider - do you have any summary thoughts on ruby2c?
ttilley has joined #ruby-lang
mindsuck has joined #ruby-lang
workmad3 has joined #ruby-lang
slaytanic has joined #ruby-lang
gnufied has joined #ruby-lang
zmack has joined #ruby-lang
<zenspider> Asher: yes
solars has joined #ruby-lang
<Asher> please share? i'm starting to think about how i will be optimizing some things that will clearly be accelerated using C… also thinking about long-term maintenance as the ruby code changes
<Asher> would ruby2c + a version managed editor for changing specific portions be a good foundation?
dc5ala has joined #ruby-lang
<TTilus> zenspider: thats RDoc::RubyLex i think
IPGlider has joined #ruby-lang
<zenspider> Asher: 'yes' was as summarized as I could get
<zenspider> Asher: what are you working on?
<Asher> i've been working for a while on a persistence layer and a view-based web framework - both are coming together now (about to start use in beta testing first production instances)
<zenspider> and how would ruby2c help with that? I can't see a view-based web framework needing it at all... and a persisntence layer? what have you done to profile and test its scalability?
<erikh> zenspider: rdoc
savage- has joined #ruby-lang
<erikh> drbrain gave me a few tasks on it, so I've been reading the source.
<erikh> I just thought the comment was hilarious
<Asher> well i haven't investigated yet to see precisely where it will help most - i do plan to do that before attempting to do so… i was more just curious how effective ruby2c is at translating the ruby and whether there were places that i might run into issues
<Asher> i've become pretty familiar with ruby C was just wondering how using ruby2c compares to writing by hand i guess
<zenspider> there's just about no way that ruby2c will work for something like a persistence layer. stick to writing it yourself... AFTER you write it in pure ruby AND come across actual bottlenecks that have been thoroughly profiled and reworked until there's no more improvements to be made in ruby
<savage-> new gem guys!
<Asher> zenspider - cool, thanks… does that mean that ruby2c is able to figure out basic ruby stuff but that tricky stuff will turn out unpredictably?
<zenspider> something like that
<zenspider> upvote?
<zenspider> sad
<erikh> hrm
io_syl has joined #ruby-lang
publicvoid__ has joined #ruby-lang
zerokarmaleft has joined #ruby-lang
publicvoid_ has joined #ruby-lang
Joeysomo_ has joined #ruby-lang
kings has joined #ruby-lang
publicvoid has joined #ruby-lang
jxie has joined #ruby-lang
telemachus has joined #ruby-lang
<erikh> got it all working, now just fiddling with markup
<erikh> rdoc has neat source
<erikh> zenspider: around?
<erikh> I was wondering if you could critique this markup: https://skitch.com/erikhollensbe/81xu9/class-rdoc-anymethod-rdoc-documentation
zmack has joined #ruby-lang
apeiros_ has joined #ruby-lang
febeling has joined #ruby-lang
RORgasm has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
tyman has joined #ruby-lang
brushbox1 has joined #ruby-lang
tyman has joined #ruby-lang
francisfish has joined #ruby-lang
bjensen has joined #ruby-lang
tekin has joined #ruby-lang
robotmay has joined #ruby-lang
toretore has joined #ruby-lang
postmodern has joined #ruby-lang
jmcphers has joined #ruby-lang
sandbags has joined #ruby-lang
zcdny has joined #ruby-lang
<zcdny> Hi, there, how to get all of methods of a object in ruby 1.9.2
<Mon_Ouie> object.methods
<Mon_Ouie> (That means *a lot* of methods though)
<zcdny> Unexpected error while processing request: undefined method `bytesize' for :t:Symbol
<zcdny> it not words
Mchl has joined #ruby-lang
dhruvasagar has joined #ruby-lang
workmad3 has joined #ruby-lang
<Mon_Ouie> You have a Symbol where you (most likely) expected a String
<tobiasvl> zcdny: if you want to just get the methods explicitly defined on the object you can do `a.methods - Object.methods`
futurechimp has joined #ruby-lang
<zcdny> The anwser is right, that upexpected error is occurred in thin server
<erikh> that doesn't cover ancestors
<zcdny> When i run it(oj.methods) via sinatra
<tobiasvl> erikh: true
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
<kalleth> tobiasvl: (a.methods - Object.methods).sort ;)
* kalleth smug
<tobiasvl> :D
<erikh> you want something like a.methods.inject(a.class.ancestors) { |x, y| x - y }
<erikh> hrm
<apeiros_> a.methods(false)+a.class.instance_methods(false)
<erikh> you want something like a.methods.inject(a.class.ancestors) { |x, y| x - y.methods }
diegoviola has joined #ruby-lang
<erikh> apeiros_: oh shit
<erikh> you're right. I completely forgot about that.
<tobiasvl> wow
<tobiasvl> well then
<apeiros_> tobiasvl: a.methods(false) will give you all methods defined only and only for a (methods on its singleton_class)
<tobiasvl> ruby outdid us once again
<apeiros_> and a.class.instance_methods(false) gives you all instance methods of a's class, without any inherited methods
<Mon_Ouie> zcdny: So, you should convert those symbols to string (like map(&:to_s))
<tobiasvl> apeiros_: thanks
<apeiros_> I have __m in my irbrc, which is defined seperately for Object, Enumerable and ActiveRecord::Base
<apeiros_> generic one is indeed .methods-Object.methods, the one for Enumerable is .methods-Enumerable.instance_methods-Object.methods, the one for AR::Base similarly as the one for Enumerable
olesu has joined #ruby-lang
judofyr has joined #ruby-lang
<Mon_Ouie> Why Object.methods and not Object.instance_methods?
<apeiros_> less to type
<apeiros_> gets a couple of methods too much, so yeah, if I don't type it by hand, I should probably change it :)
<manveru> a.class.ancestors.map{|a| [a, a.instance_methods(false)] }
<manveru> err, change that inner a to something useful :)
WillMarshall has joined #ruby-lang
jxie has joined #ruby-lang
nofxx has joined #ruby-lang
pygmael has joined #ruby-lang
ngw has joined #ruby-lang
FACEFOX has joined #ruby-lang
batmanian has joined #ruby-lang
FACEFOX has joined #ruby-lang
FACEFOX has joined #ruby-lang
FACEFOX has joined #ruby-lang
Axsuul has joined #ruby-lang
Frenda has joined #ruby-lang
<Frenda> Hello Rubyists !
<Frenda> Come on, that was mean.
radoen has joined #ruby-lang
<radoen> hi all
<radoen> i've trouble with singleton someone can take a look at http://pastebin.com/5P8TTiPY ?
<Frenda> What's the "trouble" ? :3
<judofyr> radoen: you need to "include Singleton" in the class
replore_ has joined #ruby-lang
<Defusal> so i finally got round to implementing my idea of saving models which have changed attributes on next eventmachine tick
<Defusal> hopefully this will make my life a fair amount easier
RORgasm has joined #ruby-lang
<radoen> judofyr: in this way class Websocket
<radoen> include "Singleton"
<radoen> require 'singleton' ?
<radoen>
<Frenda> radoen: require before including :)
<judofyr> radoen: and it's: include Singleton
<judofyr> no quotes
<judofyr> radoen: require only makes classes/modules available. you should probably put all requires at the top of the file.
S1kx has joined #ruby-lang
<radoen> ok no error but application dont work exit a second after start
<batmanian> what's the excon gem good for? improving performance?
<radoen> perfect now work
<radoen> thanks judofyr
kith has joined #ruby-lang
freenetw has joined #ruby-lang
srbartlett has joined #ruby-lang
kith has joined #ruby-lang
dhruvasagar has joined #ruby-lang
<apeiros_> radoen: asking in multiple places and not informing other places when you got an answer is dick behavior. don't do it.
sheldonh has joined #ruby-lang
<sheldonh> can someone verify my analysis of ruby bug #1337 (not a leet joke)? as i read these two sources of information, the bugfix never made it into 1.8.7: http://bugs.ruby-lang.org/issues/1337 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/mkmf.rb?r1=23114&r2=23113&pathrev=23114
srbartlett has joined #ruby-lang
juhl has joined #ruby-lang
<sheldonh> (i'm trying to resolve a race condition on the build of ruby-ldap)
<bnagy> apeiros_: my 0.02 - being short tempered and rude about this cross posting pet peeve of yours doesn't enhance the atmosphere of the channel
<bnagy> at the very least you could remind people politely before calling them 'dicks'
<apeiros_> bnagy: there's a difference between calling people dicks and calling their behavior dick-behavior.
<apeiros_> bnagy: noted, I'll kick again instead.
<bnagy> only a semantic one - not in the way people feel when you do it
<bnagy> anyway, as I said, just my opinion
<apeiros_> I disagree @ only semantic. as said, opinion noted. but I have enough of inconsiderate help leechers, so the most I'll do is a less emotional kick.
<apeiros_> s/I have enough/I'm fed up/
<bnagy> what to do? it's the internet. :)
meise has joined #ruby-lang
<apeiros_> that's lame-ass. I've been in irc long enough to see that it matters what you do about how people behave.
<apeiros_> if you rather put your head in the sand, fine. I won't.
<bnagy> fair enough
<bnagy> http://i.imgur.com/NYa5c.jpg -- giant cat
<lupine_85> delicious!
<shevy> you eat cats?
<shevy> omg
<shevy> that is a fat monster
<lupine_85> not ordinarily, but that one was obviously bred for meat
<bnagy> I think it would be like wagyu beef
<shevy> I mean the one who holds the cat
<shevy> kidding kidding ;)
chris2 has joined #ruby-lang
<shevy> I think the fattest cat we ever had weighed around 8kg... which is still a lot... but he was not as massive as this monster here
<bnagy> 32 lb, according to imgur, which is 14.5 kg in real units
<shevy> wheeeeeee
<shevy> he wants to be a dog!
<bnagy> on a different topic, don't suppose anyone has ever tried to get theparallel gem working with jruby?
<lupine_85> ours are 4kg
<andrewvos> CAT VIDEO^
<andrewvos> NEEDS SOUND
<bnagy> I hacked in some if RUBY_PLATFORM=='java' rubbish, but one of my classes that shells out still fails mysteriously
<bnagy> like, if it detects java I do :in_threads instead of :in_processes
<bnagy> this was after failing to get jruby to enable threads
<lupine_85> bnagy, it uses fork()
<bnagy> sorry enable fork
<bnagy> yeah, there is a jruby 'experimental
<bnagy> ' option
<bnagy> but it made no diff for me on 1.7.0-dev and ubuntu x64
<lupine_85> If you were in 1.9, you could probably hack it up to work properly with spawn()
<bnagy> I'm using 1.9 mode for jruby... but won't spawn be epic slow?
<lupine_85> but this kind of stuff in java is Not Easy(tm), generally speaking
<bnagy> like doesn't it spin up a new jvm process?
<lupine_85> I'd be surprised if they haven't optimised that case
<lupine_85> (exec under jruby 1.8 retains the JVM environment if it's for a JRuby script, for instance
<bnagy> k... I'll poke it tomorrow
<lupine_85> erm, JRuby's MRI/1.8 implementation, is what I mean
<bnagy> right. dinner. o/
setmeaway2 has joined #ruby-lang
nofxxx has joined #ruby-lang
bjensen has joined #ruby-lang
fayimora has joined #ruby-lang
JohnBat26 has joined #ruby-lang
bjensen has joined #ruby-lang
srbartle_ has joined #ruby-lang
RORgasm has joined #ruby-lang
kitallis has joined #ruby-lang
chris2 has joined #ruby-lang
chris2 has joined #ruby-lang
mark_locklear has joined #ruby-lang
justinxreese has joined #ruby-lang
morozovm has joined #ruby-lang
woollyams has joined #ruby-lang
jperry has joined #ruby-lang
mistym has joined #ruby-lang
ngw_ has joined #ruby-lang
rking has joined #ruby-lang
mytrile has joined #ruby-lang
nofxx has joined #ruby-lang
nofxxx has joined #ruby-lang
neoesque has joined #ruby-lang
woollyams has joined #ruby-lang
mattyoho has joined #ruby-lang
mattyoho has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
enebo has joined #ruby-lang
datanoise has joined #ruby-lang
Sailias has joined #ruby-lang
kitallisii has joined #ruby-lang
hirotoshi has joined #ruby-lang
nofxx has joined #ruby-lang
mistym has joined #ruby-lang
cjs226 has joined #ruby-lang
fgomez has joined #ruby-lang
kiddorails has joined #ruby-lang
Radium_ has joined #ruby-lang
dhruvasagar has joined #ruby-lang
d3vic3 has joined #ruby-lang
kvirani has joined #ruby-lang
<rue> Goddamned scrollback from like 26 hours ago -.-
<rue> That's the only real peeve about LimeChat…you can't see if you're in scrollback immediately
<tobiasvl> ditto irssi
<yorickpeterse> pfff, limechat
<andrewvos> heh
<rue> You should certainly be able to script irssi to show it at least
<tobiasvl> true
<yorickpeterse> weechat has this nice purple line that shows when you last read a message :>
<tobiasvl> oh sure, i have that in irssi too
<tobiasvl> but when i'm up to date it's at the bottom – when i'm in scrollback it's not there at all, obviously, and the two aren't that different
mstratman has joined #ruby-lang
<yorickpeterse> ah
A124 has joined #ruby-lang
wallerdev has joined #ruby-lang
slyphon has joined #ruby-lang
kurko_ has joined #ruby-lang
futurechimp has joined #ruby-lang
<andrewvos> How do I rethrow an exception inside a rescue?
<andrewvos> rethrow *the* exception I mean
<lianj> raise again?
<andrewvos> lianj: Can I just call raise or do I have to do "raise e"
<andrewvos> ?
<tobiasvl> just raise
<judofyr> andrewvos: just raise is fine
<tobiasvl> re-raises the most recent exception
<andrewvos> I really need to learn which one is the more important one
<andrewvos> It's always "raise" right?
<judofyr> andrewvos: although "raise err" is probably more explicit
<andrewvos> Hmm perhaps
nofxxx has joined #ruby-lang
paul0 has joined #ruby-lang
<Mon_Ouie> I wonder if they affect the backtrace in some way
<andrewvos> Mon_Ouie: Like in .NET?
<andrewvos> I think just raise would be the best approach not "raise e"
<andrewvos> It is kind of obvious
nofxx has joined #ruby-lang
gnufied1 has joined #ruby-lang
<tobiasvl> yeah, the ruby "idiom" in this case is to just raise
msisk has joined #ruby-lang
<rue> Mon_Ouie: I don't think so
codewrangler has joined #ruby-lang
nofxxx has joined #ruby-lang
<rue> I would always use just raise in that case, because if you use raise ex, I'm going to assume that ex isn't the same ex you rescued
<Mon_Ouie> Yeah, I tried, none of them change it
<tobiasvl> rue: yeah exactly
<tobiasvl> judofyr called it more explicit but i think it's more confusing
<tobiasvl> just `raise` IS explicit :)
ddfr3yne has joined #ruby-lang
dv310p3r has joined #ruby-lang
slyphon has joined #ruby-lang
Austin__ has joined #ruby-lang
olesu has joined #ruby-lang
dfr|mac has joined #ruby-lang
nofxx has joined #ruby-lang
esad has joined #ruby-lang
RORgasm has joined #ruby-lang
mistym has joined #ruby-lang
dfr|mac_ has joined #ruby-lang
<rue> Yep
<rue> Bad judofyr
<judofyr> okay, okay
<shevy> raise Raise
<shevy> the final stage is RAISE
IPGlider has joined #ruby-lang
headius has joined #ruby-lang
<andrewvos> shevy: Quite often you just don't make any sense.
<shevy> andrewvos you are a wise girl.
<andrewvos> shevy: I know you probably think I'm really pretty from my twitter picture, but I'm actually a guy.
nofxx has joined #ruby-lang
dfr|mac has joined #ruby-lang
RubyRedGirl has joined #ruby-lang
<shevy> andrewvos sorry, never been to your twitter. Don't think I could then use the word wise, so perhaps just ... You are a guy.
JEG2 has joined #ruby-lang
slimfit has joined #ruby-lang
RORgasm has joined #ruby-lang
tekin has joined #ruby-lang
outoftime has joined #ruby-lang
Sailias has joined #ruby-lang
thone_ has joined #ruby-lang
io_syl has joined #ruby-lang
dajmon has joined #ruby-lang
<dajmon> hello, i'm a student conducting a study. click for more info: http://pastie.org/3547791
wallerdev has joined #ruby-lang
<outoftime> anyone know if there's a good ORM-agnostic standalone migrations framework out there?
optikalmouse has joined #ruby-lang
imajes has joined #ruby-lang
<rue> Yeah, there's one
<rue> It's called SQL
<optikalmouse> rue: what was the question?
<apeiros_> but that's not database-agnostic!
<optikalmouse> apeiros_: yeah it is, SQL works on different SQL servers ;p
<apeiros_> optikalmouse: 16:24 outoftime: anyone know if there's a good ORM-agnostic standalone migrations framework out there?
<apeiros_> but sql is certainly the fastest, especially for data migrations…
<outoftime> rue, optikalmouse I'm not talking about SQL
<outoftime> rue, optikalmouse I'm talking about having a set of scripts and keeping track of which ones have already been run, and which ones haven't, and then running the ones that have
<Mon_Ouie> If you were talking about anything, that'd mean you know the answer to your question
<outoftime> Mon_Ouie: huh?
<outoftime> oops, s/have$/haven't
<apeiros_> outoftime: um, building something like that is like… 10 lines of code?
<outoftime> apeiros_: sure is. still could be 10 lines I don't have to write : )
<apeiros_> outoftime: integrating an abstracted framework probably takes just as many lines
ericmuyser has joined #ruby-lang
<outoftime> apeiros_: could be
<apeiros_> additionally, it takes time to understand the approach etc.
<outoftime> apeiros_: OK, I'll just write it, and then the answer when future outoftimes have this question will be "yes" : )
<apeiros_> hah
<rue> Unless you're ibid
<apeiros_> the future outoftimes then will say "naaah, that makes assumption X, which doesn't work for me!!!!" ;-p
<outoftime> apeiros_: I was thinking swappable backends for storing the list of migrations you've run, and no other assumptions at all
<outoftime> not like, trying to provide a bunch of abstractions around data definition statements a la AR migrations
<outoftime> as rue pointed out, SQL is pretty great at SQL.
<apeiros_> unless you use an almostSQL db…
<outoftime> apeiros_: that happens to be precisely my use case
Radium has joined #ruby-lang
_cam has joined #ruby-lang
wallerdev has joined #ruby-lang
<optikalmouse> outoftime: it's easiest to write your own SQL scripts if you want it to be ORM-agnostic. you don't need a "framework" for this.
<outoftime> optikalmouse: again, I'm not looking for something to *perform* migrations. you're right, you can just write SQL scripts
<outoftime> optikalmouse: just something to keep track of which migrations have been run and which haven't, and easily do things like rollback etc.
<outoftime> optikalmouse: what actually goes in the migration would just be whatever ruby code you want.
<optikalmouse> write some extra ruby code that writes down which migrations were run.
naz has joined #ruby-lang
<optikalmouse> perhaps by appending to a file or inserting a row in a database listing the script name that was run and when.
<optikalmouse> I don't know, maybe that would work, I haven't had a coffee yet.
<outoftime> optikalmouse: right, that's what I have in mind, just a little library to take care of the details of that with swappable storage for the list of what's been run
<optikalmouse> write it, you don't need a framework for that.
<outoftime> "framework" is probably not the right word, but a little library to take care of the details would, I think, be a good contribution to the community
<outoftime> and so I shall write it and make it available to the world.
jxie has joined #ruby-lang
<optikalmouse> make it as simple as possible, but not simpler.
<outoftime> optikalmouse: sound advice : )
* apeiros_ has the feeling that using transient objects is somehow a bad pattern…
<apeiros_> e.g. in a DSL, where you accumulate state, then extract the completed state and drop the proxy
<apeiros_> but I don't see any better way :-/
<outoftime> apeiros_: in what context?
joshkraemer has joined #ruby-lang
<outoftime> apeiros_: oh, I see. so an object that just exposes the DSL, which encapsulates the actual state of the DSL
<apeiros_> correct
<outoftime> apeiros_: i definitely think there are situations where that pattern is the best
kain_ has joined #ruby-lang
<rue> I dunno if there's anything inherently bad about ith
<rue> Except apparently causing me to make typos
16SAA0QJD has joined #ruby-lang
slyphon has joined #ruby-lang
judofyr has joined #ruby-lang
rippa has joined #ruby-lang
t has joined #ruby-lang
francisfish has joined #ruby-lang
malev has joined #ruby-lang
rdavila has joined #ruby-lang
futurechimp has joined #ruby-lang
bglusman has joined #ruby-lang
slimfit has joined #ruby-lang
esad has joined #ruby-lang
freenetw has joined #ruby-lang
workmad3 has joined #ruby-lang
jtoy has joined #ruby-lang
hynkle has joined #ruby-lang
febeling has joined #ruby-lang
crackity_jones has joined #ruby-lang
gregf has joined #ruby-lang
<wwalker> is there a way to differentiate in a method between "@a has been set to nil" and "@a has never been set"?
<shevy> wwalker without using an extra variable not, afaik
<judofyr> wwalker: defined?(@a)
<bnagy> yeah that
<bnagy> except without parens
<judofyr> parens works fine
<bnagy> oh, of course
<bnagy> they're just ugly an redundant
<wwalker> thank you. I was messaing with instance_variable_defined?() yesterday and it didn't work as expected (probably me being exhausted...)
<judofyr> well, defined? is funky syntax; I like to see when it ends
<judofyr> wwalker: defined? does the same as instance_variable_defined? so it might not fix your problem
<bnagy> I feel the same way about Fox News
andrewhl has joined #ruby-lang
<judofyr> bnagy: defined? a + 2
<judofyr> although that's a silly example
<shevy> at least Fox News randomly adds "boobs" or "fuck" to their news. that is worth something
<judofyr> puts(defined? a + "\n")
<judofyr> doesn't work as expected
<bnagy> wow, you're right
<judofyr> (for certain values of "expect")
<bnagy> all your examples of instances where parens are needed make mine where they are ugly and useless totally irrelevant!
b0ggs has joined #ruby-lang
<lianj> a parens hater huh?
<bnagy> it's like life is... somehow context sensitive. Weird
dajmon has joined #ruby-lang
<judofyr> bnagy: I wasn't trying to prove you wrong.
JohnBat26 has joined #ruby-lang
<bnagy> if only there were some kind of computer parser that could arbitrate
<judofyr> yeah, yeah
<shevy> I like parens
<shevy> especially in lisp
<bnagy> judofyr: it's ok, I'm just drunk and od'ed on imgur
joshkraemer has joined #ruby-lang
<shevy> (so(cool(to(do(this
<bnagy> I don't mean it
<judofyr> defined?(defined?)
<shevy> wat
<judofyr> shevy: guess the result
<shevy> true!
<rippa> syntx error
<judofyr> wrong :)
<judofyr> rippa: correct ;)
<shevy> what is a "syntx error"
<rippa> it's like a syntax error
<rippa> bt drunk
<shevy> cool
<bnagy> o/
<bnagy> variables are not methods!!1!
<shevy> hmm
<judofyr> bnagy: what'd you mean?
<bnagy> ... but srsly I wish I knew why that's a syntax error :(
<shevy> not even in lisp?
<judofyr> bnagy: because defined? is syntax-thingie, not a method. it requires a "parameter" to the right
<judofyr> it's the inner defined? that's a syntax error
<bnagy> ahh
<judofyr> kinda like writing defined?(def)
futurechimp has joined #ruby-lang
<judofyr> shevy: ))))
<judofyr> shevy: you need to close your parens!
<shevy> man see
<shevy> that is the part in lisp I dont like :(
<shevy> I look into the future, I only want to open things, not close them
<judofyr> I think some lisps had "superparens" which closed all the parens above
<shevy> hehehe
<shevy> that sounds like superparents
tbuehlmann has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
IPGlider has joined #ruby-lang
mark_locklear has joined #ruby-lang
mssola has joined #ruby-lang
apeiros_ has joined #ruby-lang
Indian has joined #ruby-lang
macmartine has joined #ruby-lang
pygmael has joined #ruby-lang
dfr|mac has joined #ruby-lang
dfr|mac_ has joined #ruby-lang
butchanton has joined #ruby-lang
futurechimp has joined #ruby-lang
kiddorails has joined #ruby-lang
dfr|mac has joined #ruby-lang
crudson has joined #ruby-lang
brianpWins has joined #ruby-lang
<andrewvos> Yes. Hilarious.
yxhuvud has joined #ruby-lang
savage- has joined #ruby-lang
<andrewvos> Hey ruby-lang. If I want to ssh into an ubuntu box and type commands as if I was actually typing them into a terminal when logged into the machine, how would I do this?
<andrewvos> For example, if I ssh in to a box and run cucumber then I want firefox to open up on that actual box.
<apeiros_> andrewvos: net/ssh
<andrewvos> Open up on the display plugged into that box Imean
<andrewvos> And I don't want to use vnc because the connection is too slow
<andrewvos> Also, -X sucks
pemeon has joined #ruby-lang
shtirlic has joined #ruby-lang
<andrewvos> apeiros_: That's just a gem right?
<apeiros_> andrewvos: yes
<apeiros_> but I'm not sure I really got your problem
<andrewvos> Well, for example if I ssh in and run `firefox` I get "Error: no display specified"
<andrewvos> apeiros_: ^
shtirlic_ has joined #ruby-lang
<apeiros_> andrewvos: ah, I see. can't help with that.
solars has joined #ruby-lang
Sailias has joined #ruby-lang
kurko_ has joined #ruby-lang
<hagabaka> DISPLAY=:0 firefox?
<hagabaka> > andrewvos
<andrewvos> hmmm
fgomez has joined #ruby-lang
olesu has joined #ruby-lang
<hagabaka> you would need to do the same if you log in to a new console session (Ctrl+Alt+F1, not terminal) on that computer
<hagabaka> ...and run an X program in it
ironcamel has joined #ruby-lang
<erikh> ssh -X host 'firefox'
ironcamel has quit [#ruby-lang]
fgomez has joined #ruby-lang
<erikh> rush is the best band ever created
<apeiros_> erikh: hm, he said -X sucked - didn't say why, though
ryanf has joined #ruby-lang
<erikh> it's the interbutts! you don't need a reason.
ironcamel has joined #ruby-lang
<andrewvos> apeiros_: Cause it's slow!!
dajmon has joined #ruby-lang
<andrewvos> Right fuck this I'm going home! Thanks for the help xx
d3vic3 has joined #ruby-lang
flak has joined #ruby-lang
Austin__1 has joined #ruby-lang
<erikh> andrewvos: x is slow period
Carnage\ has joined #ruby-lang
<erikh> but, what you want is
<erikh> xhost +
<erikh> then export DISPLAY="my.ip.address:0"
<chris2> erm
<chris2> pleasz
<chris2> xhost +<ipaddress>
<erikh> heh
<erikh> what's the fun in that?
<chris2> hehe
<erikh> no playing around with forking xmessage
<chris2> no key sniffing
<erikh> oh yeah.
<erikh> don't you have to be focused in the remote client window for that to work though?
<erikh> I don't know a lot about X, but it seems logical
<chris2> no
<erikh> interesting.
<chris2> think xbindkeys
<erikh> ah
savage- has joined #ruby-lang
dfr|mac has joined #ruby-lang
<jtoy> what is a good way to match a url from a string? this is not working for me: "asdsa http:/asdasdsad.com asdasd".match(/[http://\S+]\s+/)
<apeiros_> URI.extract
<jtoy> apeiros_: nice, didn't know about that
<apeiros_> read the docs, it accepts a schemes arg.
dfr|mac_ has joined #ruby-lang
dfr|mac__ has joined #ruby-lang
rdavila has joined #ruby-lang
dfr|mac has joined #ruby-lang
krz has joined #ruby-lang
<jtoy> apeiros_: hmm, it accepts things like Specials: and week:
<erikh> so does the URI specification
<apeiros_> btw., your match wasn't working because you wrote http:/ instead of http:// in your string
<hagabaka> it should be ( ) instead of [ ], and escape / inside
<apeiros_> ah, should actually just drop [], and yes, escape / or use %r
outoftime has joined #ruby-lang
<apeiros_> and probably drop the \s+ too
wycats_ has joined #ruby-lang
<Defusal> im guessing theres no easy way to hook all modifier methods for a class, like Array#<< and Hash#[]=
olesu has joined #ruby-lang
* apeiros_ wonders what that's supposed to mean
<Mon_Ouie> No, but maybe that means you shouldn't return an array or a hash, and instead your own object that wraps it
<Mon_Ouie> (I'm assuming that means, doing something whenever a specific array or hash is modified)
kurko_ has joined #ruby-lang
morozovm has quit [#ruby-lang]
rippa has joined #ruby-lang
<Defusal> Mon_Ouie, well i was just gonna modify the singleton class of the object being returned
<Defusal> but it'll have to wait, i don't have time to handle every possible modifier method
<Defusal> i could possibly make the wrapper proxy all method calls, and check if the objects data has changed before returning the result, though that would not be too efficient
deobald has joined #ruby-lang
<erikh> man I am looking forward to TCO in ruby 2.0
<yxhuvud> tco?
lsegal has joined #ruby-lang
<_cam> tail call optimisation?
<erikh> yxhuvud: yeah
<Mon_Ouie> Defusal: That's why I'd recommend you create an object with a restricted interface so you can deal with modifications more easily
ryanf has joined #ruby-lang
<Defusal> yeah
ridders24 has joined #ruby-lang
maja has joined #ruby-lang
maja has joined #ruby-lang
achiu has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
olesu has joined #ruby-lang
jacktrick has joined #ruby-lang
musl has joined #ruby-lang
fgomez has joined #ruby-lang
senthil has joined #ruby-lang
lsegal has joined #ruby-lang
_cam has joined #ruby-lang
workmad3 has joined #ruby-lang
nightlycoder has joined #ruby-lang
outoftime has joined #ruby-lang
krzkrzkrz has joined #ruby-lang
nofxx has joined #ruby-lang
benanne has joined #ruby-lang
tjadc has joined #ruby-lang
boxmo has joined #ruby-lang
francisfish has joined #ruby-lang
dejongge has joined #ruby-lang
Skif has joined #ruby-lang
workmad3 has joined #ruby-lang
olesu has joined #ruby-lang
savage- has joined #ruby-lang
dajmon has joined #ruby-lang
vesan has joined #ruby-lang
<slyphon> is there a thing to make an array 'circular'?
<rippa> how?
<slyphon> like you set the items [1,2,3]
<erikh> like a circular linked list?
<slyphon> and then call .next and it just returns 1,2,3,1,2,3,1,2,3
olesu has joined #ruby-lang
<rippa> array.cycle
<slyphon> yes! thank you!
<erikh> whoa, neat.
febeling has joined #ruby-lang
rdavila has joined #ruby-lang
krzkrzkrz has joined #ruby-lang
mssola has joined #ruby-lang
kiddorails has quit [#ruby-lang]
<rue> Enumerable is the best thing in the history of things
<andrewhl> If I have a .txt file that consists basically of words like this: "ALLOW","ALMOST","ALONE","ALONG", how can I parse it into an array of just the words, minus the quotation marks? split(",") produces this: "\"ALLOW\"", "\"ALMOST\"", "\"ALONE\"", "\"ALONG\""
<slyphon> rue: amen
<slyphon> i still don't totally get it
<shevy> andrewhl .split and .map
postmodern has joined #ruby-lang
<andrewhl> shevy: can you be more specific?
<shevy> array.map {|x| x.delete '"' }
<shevy> .gsub would work too
<shevy> array = '"ALLOW","ALMOST","ALONE","ALONG"'.split(',').map {|x| x.delete '"'}
<shevy> # => ["ALLOW", "ALMOST", "ALONE", "ALONG"]
<andrewhl> by the same logic, couldn't I do something like: .split('\",\"')?
<canton7> sure. You'd have to make sure you removed the first and last quotes as well, though
<shevy> andrewhl I dont know what logic
<shevy> perhaps it works, perhaps not
<shevy> there are thousand ways to do ti!
<shevy> *it
<shevy> adding a method .remove_quotes :)
<andrewhl> heh, ok
boxmo has joined #ruby-lang
<TTilus> andrewhl: you mean you have a csv file?
<TTilus> > CSV.parse('"ALLOW","ALMOST","ALONE","ALONG"')
<TTilus> => [["ALLOW", "ALMOST", "ALONE", "ALONG"]]
vesan has joined #ruby-lang
<andrewhl> interesting
<TTilus> ?
<andrewhl> ttilus: I'll try it, thanks
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
dajmon has joined #ruby-lang
florentg2 has joined #ruby-lang
<crankharder> say i have str = "def foo ; puts 123 ; end" how can I add that method to a class?
slimfit has joined #ruby-lang
jfelchner has joined #ruby-lang
<jarib> crankharder: TheClass.class_eval(str)
<jarib> (assuming you want it as an instance method)
Axsuul has joined #ruby-lang
<crankharder> yessir
robbyoconnor has joined #ruby-lang
<shevy> hmm
dv310p3r has joined #ruby-lang
<shevy> class_eval.rb:19:in `<main>': undefined method `class_eval' for #<Foo:0x00000000abb378> (NoMethodError)
<shevy> oh no wait
<shevy> works now
<Mon_Ouie> You call it on an instance of the class, not on the class
<shevy> yeah
febeling has joined #ruby-lang
<youngin> hehe
<youngin> ouie ouie =)
woollyams has joined #ruby-lang
senthil has joined #ruby-lang
Carnage\ has joined #ruby-lang
<crankharder> I know this is ridiculous before i even ask...
<crankharder> say, class Foo ; def bar ; puts 123 ; end ; end
<crankharder> given something like "Foo.bar", can I get "def bar ; puts 123 ; end"
<apeiros_> crankharder: not really, no
surfprimal has joined #ruby-lang
<apeiros_> you can use something like Method#source_location to figure from where it is and ripper to parse the source
<apeiros_> or yard
<crankharder> yea, thought of that, but the def might not be in the class definition
<crankharder> module or some sech
<apeiros_> or you could see how pry does it, but I guess pry does just one of those two ways
<crankharder> what does pry do?
<crankharder> that is, i haven't used pry, how would i use pry to get this result
<apeiros_> install pry, fire it up, do $ Foo.new.bar
<apeiros_> oh, actually, `$ Foo#bar` works too
<Mon_Ouie> It uses source_location, check the source code from the method_source to see how exactly
bjensen has joined #ruby-lang
<apeiros_> Mon_Ouie: heuristics (indent), custom parser or ripper?
<crankharder> [7] pry(main)> `$ Foo#bar`
<crankharder> sh: $: command not found
<crankharder> => ""
<apeiros_> crankharder: errrm, *obviously* the `` were to delimit
<bjensen> Given an array: [36, 4, 1, 17, 2, 3, 37, 39, 36, 4, 39, 38, 2, 1], how would you guys check how many times each integer occurs in the array?
<crankharder> [8] pry(main)> Foo#bar
<crankharder> => Foo
<crankharder> ?
<apeiros_> bjensen: I'd use group_by, then map and .size
<apeiros_> crankharder: *facepalm*
<apeiros_> if I say `$ Foo#bar`, and `` are delimiting, what do you think do you have to type?
<bjensen> ah group by..I thought it only worked with rails, thanks
<Mon_Ouie> Actually it seems to use Ripper, or RubyParser when it is not available
shtirlic has joined #ruby-lang
<crankharder> shhhh i figured it out
<apeiros_> bravo :)
<crankharder> i'm awesome i know
<Mon_Ouie> Probably just reading until the expression is valid
jbsan_ has joined #ruby-lang
Defusal_ has joined #ruby-lang
meise_ has joined #ruby-lang
<dragonkh> hi
<Kero> hi!
ixx has joined #ruby-lang
<dragonkh> whats the best version of ruby for speed and performance as well as stability? is it 1.9.3 or jruby or something else?
<dragonkh> hey Kero !! long time !!
<dragonkh> how are you ?
slimfit has joined #ruby-lang
nofxx has joined #ruby-lang
<chris2> wow, kero
<Kero> doing fine! little to no ruby, but still programming for a living ;)
<chris2> hehe
<Mon_Ouie> There's no implementation that is *always* faster than the others
<Kero> hi chris2!
dhoss has joined #ruby-lang
<Kero> reunion time, it seems :)
<Kero> how are you both/all doing?
<bjensen> for the curious. this is how I solved the problem: group_by{|d| d}.map{|k,v| puts "number #{k} occurences: #{v.size}"}
<chris2> Kero: yeah, fine
<headius> dragonkh: I'd say jruby, but I'm a little biased
<apeiros_> headius: heh, nooo, nooo, how'd you be biased? :D
<headius> just a little!
* apeiros_ guesses headius is right, especially for long running processes
<apeiros_> it's a very educated guess, too!
<dragonkh> hehe
<dragonkh> hey headius - long time since I seen you too !!!
<chris2> it certainly isnt optimized for short running processes :P
<headius> hiya!
<apeiros_> oh, not to forget threading. I think jruby is still the sole contender there
<dragonkh> im looking at the falcon patch : https://gist.github.com/1688857
<dragonkh> I'm great !!
<dragonkh> that was not a general statement - it was in reply to Kero !!
<Kero> :)
<dragonkh> jruby is nice - but I had a lot of issues getting rails to run on it - mostly around oracle driver support and other driver based things
rushed has joined #ruby-lang
<apeiros_> ooooraaaacllleeee!
* apeiros_ needs the kahn-meme
* Kero has some shiny new hardware up and running (Genesi Efika), and it's about time to install the ruby webservice. Watching to see how the ruby vs jruby discussion turns out and whether it applies to linux/arm ;)
* apeiros_ keeps repeating his new mantra… "only half a year, only half a year, …"
<headius> our oracle driver isn't great...the oracle-enhanced adapter is more complete
<headius> Kero: jruby works fine on arm
<headius> I've only tested the (non-free) oracle JVM for ARM
<dragonkh> I had to hack large parts of the oracle driver to get it working I remember
<headius> freely downloadable though
<dragonkh> and I was thinking - maybe noone uses oracle with rails on jruby hehehhe
VegetableSpoon has joined #ruby-lang
<Kero> headius: it's a mess on debian x86, in the sense that `gem list` does not run (last time I tried). Have not tried on debian arm, yet
<slyphon> array.to_enum.cycle FTW
<headius> Kero: what's a mess?
* slyphon waves to headius
<headius> slyphon: hiya!
<Kero> jruby -S gem list
<headius> Kero: hmm, that oughta work fine
<headius> I know debian's packages are way behind though
<headius> for jrub
<headius> y
<slyphon> headius: hey, two quick questions: InvokeDynamic and maven integration
<headius> our CI runs on debian (ubuntu, but yeah)
<headius> slyphon: ok, what's the questions? :)
<slyphon> there was some InDy blog post that showed the magic properties to adjust
<Kero> yeah, guessed as much. the load on my server is very low, so I don't really care which ruby version I run.
<slyphon> i can't find
<slyphon> and the maven thing wound up...?
<headius> properties for JRuby or JVM?
<slyphon> yes?
outoftime has joined #ruby-lang
<slyphon> either?
* slyphon <-- ignorant/innocent
<headius> these days you probably don't need to mess with either
<slyphon> oh, cool
<headius> get an OpenJDK 7u2 or higher and run JRuby master
<headius> it will just use indy
* slyphon chuckles at "these days"
* slyphon blinks
<drbrain> hrm, that's not right
<slyphon> drbrain: uh, are you banning everyone?
<drbrain> please hold on while I figure out how to use my IRC client again!
* slyphon ducks and covers
<slyphon> mwuahahahah!
<zenspider> that's it
* apeiros_ op #ruby-lang
<apeiros_> aaah
<apeiros_> dang
<slyphon> hahahah
<apeiros_> slyphon deoped too soon
<slyphon> OH NOES
<slyphon> yay! we're all trying on our hats!
<slyphon> god
<slyphon> zenspider: what was the name of that fucking troll?
<slyphon> you remember that
<zenspider> which one?
* Kero filters out FIN packets so his connections do not die
<slyphon> back in the day, kid from alaska or some shit
<zenspider> tsume aka dross aka some furry name
<slyphon> hah!
<slyphon> yes!
<Kero> oh dear. memory lane.
<slyphon> jeez
<slyphon> i think that's why i got ops in the first place
<zenspider> he trolled me a couple months ago...
<zenspider> apparently he's a furry AND a security guard or somesuch
<slyphon> wow!
dv310p3r has joined #ruby-lang
<slyphon> that's awesome
<dajmon> does he wear his tail to be intimidating, do you think
<dajmon> and swing it around
michael_mbp has joined #ruby-lang
s0ber_ has joined #ruby-lang
y3llow_ has joined #ruby-lang
<michael_mbp> hey thanks drbrain
<zenspider> zenspider... saving the channel from drbrain...
<shevy> there can only be one!
<michael_mbp> right, so passing an object to a block, what mechanism implies that it needs to respond to call?
butchanton has joined #ruby-lang
<michael_mbp> *correction, passing an object /instead/ of a block.
<slyphon> through what syntax would you do that?
<apeiros_> michael_mbp: you mean &some_obj? it uses to_proc
<michael_mbp> hey apeiros_ how are you mate
gix has joined #ruby-lang
fgomez has joined #ruby-lang
<slyphon> oh god
<apeiros_> michael_mbp: I'm awesome just right now. I finally reinvented my stupid parser :)
<apeiros_> and it even *works*
<michael_mbp> so instead of ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, started, finished, unique_id, data|, if I were to do ActiveSupport::Notifications.subscribe("process_action.action_controller", FancyObject.new), it would expect FancyObject.new to respond to def call(name, started, finished, unique_id, data) ...
y3llow has joined #ruby-lang
<apeiros_> michael_mbp: if you do it that way, it depends entirely on ActiveSupport::Notifications.subscribe
<michael_mbp> hmm….
<apeiros_> so you'll have to read the API docs of that method, whether it supports it at all.
<zenspider> michael_mbp: I think it's just duck typing... make an obj that responds to call and pass it instead of a block
<michael_mbp> glad to hear that, I thought i was some ruby mechanism that I'd missed.
<zenspider> nah
<michael_mbp> zenspider: it feels like that
<krazyj> in ruby, is the correct denotation for a public instance method a '#'? i.e. '#update'
<krazyj> for `def update`
<zenspider> they've got code like: def x obj = nil, &block; (block || obj).call(args)
<zenspider> krazyj: yes, as stolen from smalltalk
<michael_mbp> where are you seeing that?
<krazyj> zenspider: thanks
<krazyj> also, is there any way to abbreviate this? https://gist.github.com/a798afc1cb6bb90bf15e
y3llow has joined #ruby-lang
<krazyj> is there anything in ruby like in C where, if i have 1-line if statement, i don't need braces?
<zenspider> remove begin/end
<zenspider> change while! to until
<krazyj> zenspider: how is that indented?
<zenspider> refactor and add a method to shapefile so you're not raping demeter
<michael_mbp> zenspider: `def x obj = nil, &block; (block || obj).call(args)` ??
<michael_mbp> did you find that somewhere or… ?
<zenspider> michael_mbp: no, I just gave you a generic example
<michael_mbp> ah right
<michael_mbp> yeah that does seems like the case
<krazyj> zenspider: is there any way to wrap that? it's pretty long… http://screencast.com/t/qRr7ma2fW8s
<zenspider> krazyj: x = y until z or x = y until\n z
<krazyj> k
<zenspider> like I said... refactor
<zenspider> you're writing horribly ugly code. make it pretty with extra methods
<krazyj> zenspider: so, like this
<zenspider> you changed while ! to until !
<krazyj> eh… @shapefile is an object from another library
<zenspider> it should be while ! becomes until
<krazyj> ah yes
<zenspider> so? put a method on it
benanne has joined #ruby-lang
<krazyj> zenspider: i'd have to open up the library and add a new method, no?
<zenspider> no
<zenspider> remember kids... Ruby is Dynamic (tm)
<michael_mbp> def subscribe(pattern = nil, block = Proc.new); subscriber = Subscriber.new(pattern, block).tap do |s|
<zenspider> generated_point = random_point_in_bounding_box until @shapefile.contains? generated_point
<krazyj> zenspider: so how do i cause `@shapefile.contains?` to be interpreted as `@shapefile.get(0).geometry.contains?`
lsegal has joined #ruby-lang
<zenspider> def contains? x; self.get(0).geometry.contains? x; end
<michael_mbp> zenspider: that give you any clues?
<zenspider> put that in whatever class @shapefile is
<zenspider> michael_mbp: I'm not sure what you're asking me
VegetableSpoon has quit ["Leaving"]
<michael_mbp> aha
<michael_mbp> line 49
<michael_mbp> if listener.respond_to?(:call)
<zenspider> YAY! no more failing test cases for 1.9 parsing in ruby_parser!
<apeiros_> is ruby_parser for 1.9 a wrapper on ripper?
<drbrain> apeiros_: no
senthil has joined #ruby-lang
<rue> Hurray
nofxx has joined #ruby-lang
heftig has joined #ruby-lang
tonesfrommars has joined #ruby-lang
<zenspider> apeiros_: lemme clarify: dear god no
<apeiros_> lol
<apeiros_> ripper so bad?
<zenspider> it's very messy
<zenspider> I could prolly do it, but I don't wanna
<zenspider> there's too much in ripper that is impl specific and it is subject to too much change
Sailias has joined #ruby-lang
<owen1> how to send push request to a ruby gem on rubyforge?
workmad3_ has joined #ruby-lang
<rue> owen1: You can't. Some have trackers that you can use
kurko_ has joined #ruby-lang
<rue> How old is the gem?
partydrone has joined #ruby-lang
ericmuyser has joined #ruby-lang
vpamulap has joined #ruby-lang
slaytanic has joined #ruby-lang
<andrewvos> sup ruby-lang
fgomez has joined #ruby-lang
mistym has joined #ruby-lang
<andrewvos> SUP RUBY-LANG
<lianj> ONE DAY TILL WEEKEND
<andrewvos> AWW YEAHHH
<krazyj> zenspider: doing `X until Y` seems to be breaking my code
<krazyj> something in the conditional statement is turning nil
srbartlett has joined #ruby-lang
<zenspider> krazyj: you should probably fix that then
<krazyj> yeah...
nightlycoder has quit ["Ухожу я от вас (xchat 2.4.5 или старше)"]
<krazyj> well, the parts of the X until Y work fine, independently, in the console
nofxxx has joined #ruby-lang
<zenspider> no prob
boxmo1 has joined #ruby-lang
<krazyj> anyone have any ideas on my `X until Y` weirdness…. https://gist.github.com/131b35a582ab64bb39da
<krazyj> when i do all of the pieces in the console, it works fine
<krazyj> when i call those same pieces from a method, it appears the something in the conditional statement turns into nil?
<andrewvos> the fuck am I looking at krazyj
<krazyj> top part is the method, input manually on the console
<krazyj> middle is the output from running that method
<krazyj> bottom is the implementation
<andrewvos> so, what's the problem?
<krazyj> basically, i'm trying to do line 28
<krazyj> but it throws the error starting on line 10
<krazyj> but, if i evaluate all of the pieces by hand at the console, it all evaluates correctly
<andrewvos> make the code more simple
<listrophy> krazyj: shapefile... is it an attr_accessor? is it memoized?
<krazyj> listrophy: yes, it's an attr_accessor
<listrophy> krazyj: if so, then you should be calling the accessor in def generate
<krazyj> ahh
<listrophy> (for starters)
<krazyj> listrophy: removing the attr_accessor line doesn't fix it
<listrophy> krazyj: no, i mean on line 28, remove the '@'
<krazyj> listrophy: it's an ivar
<krazyj> line 43
elalande has joined #ruby-lang
<listrophy> krazyj: yeah... so, it's kind of a style thing. I would claim that if you have an attr_accessor, you should almost always use the method, not the ivar
slyphon has joined #ruby-lang
<krazyj> ah ok, i see what you mean
<krazyj> in that case, it's only an attr_accessor for debugging purposes
<listrophy> k. anyway, adhering to the style i described allows one to easily drop in things like memoization
<listrophy> oh, i see it
* krazyj needs to research memoization.. not familiar
<listrophy> krazyj: on line 28
<zenspider> I'd have to guess that @factory is nil, no?
<krazyj> zenspider: yes. line 11
<listrophy> krazyj: the expression to the right of 'until' is executed before the expression on the left
<krazyj> listrophy: yeah, that's causing the error
<krazyj> :|
<krazyj> thought it was reverse
<zenspider> you should remove bundler and thor from the equation
<krazyj> ok, well thanks listrophy :)
<krazyj> is there a syntax for evaluating the conditional after execution of the body?
<krazyj> like do/while
<listrophy> and until has lower precedence than assignment
<krazyj> listrophy: what do you mean by that?
<listrophy> krazyj: suffice it to say, if you split the line into three sections: before "=", between "=" and "until", and after "until", the third item is evaluated before the first two
<listrophy> that is, "until" acts as the line's "first" hinge, not the "="
<listrophy> and "until" is right-associative
<listrophy> but perhaps that's a little too much jargon?
brushbox has joined #ruby-lang
<krazyj> listrophy: no, i think i'm following
<krazyj> until is executed first, then everything before until
<krazyj> …until the conditional is achieved :P
<krazyj> s/executed/evaluated
<listrophy> hopefully i didn't bugger up the terminology, but you seem to be on the right track
<krazyj> cool. thanks a bunch listrophy
<listrophy> yup
<listrophy> np
<krazyj> that said… do you know off the top of your head what kind of 'different' control structures are found in ruby? i.e. not the usual if/while variants
<krazyj> i've noticed until and unless
<listrophy> "and", "or" are slightly different from "&&", "||"
<listrophy> they act the same, but with different precedence
<listrophy> krazyj: beyond that, i dunno. look up the reserved words list =)
<krazyj> thanks :)
<listrophy> heh, technically, lambdas can be abused as control structures =)
<drbrain> listrophy: if you're only abusing lambdas you're not trying hard enough… return_bang uses callcc
guns has joined #ruby-lang
<listrophy> drbrain: i was referring to http://experthuman.com/programming-with-nothing
srbaker has joined #ruby-lang
woollyams has joined #ruby-lang
countskm has joined #ruby-lang
My_Hearing has joined #ruby-lang
Joeysomo has joined #ruby-lang
<countskm> does anyone here "corral" their modules under lib in a different way or just lay them out w/ the classes
<countskm> corral=group sorry i know this is an international channel - actually unless u are from texas i dunno if you have heard that ;-)
<michael_mbp> hi anyone know whom I can contact in #ruby to get unbanned for having (had) a terrible net connection and cycling/bouncing a lot ?
<zenspider> michael_mbp: don't bother. #ruby is a waste of time
<michael_mbp> ah
<michael_mbp> been a while since I've been there to remember.
<listrophy> michael_mbp: also, consider using a server + screen or tmux + irssi
<zenspider> countskm: with classes/module mapping
<michael_mbp> listrophy: yes, that's definitely on my todo
<michael_mbp> I used to have an irssi setup ages ago
<countskm> not familiar w/ that - can u elaborate a tad more?
<michael_mbp> I've already got a personal linode VPS for serving rack apps.
<countskm> funny i googled something before asking and ur quickref came up - coincidence or no? :-)
<countskm> is that a github project?
boxmo has joined #ruby-lang
<countskm> by default, i would just put the module in the same lib/ subdirectory - but something feels a little weird about having it w/ other things that get instantiated
<countskm> maybe i am being to anal
<zenspider> at this stage I have no idea what you're asking
<countskm> i guess the module does get instantiated thru proxy of an object that includes it
<countskm> k np
<countskm> its just a namespace rather than a technical problem
<countskm> like the quickref btw
<countskm> "
<countskm> "don't rescue Exception. EVER. or I will stab you." lol
fgomez has joined #ruby-lang
<countskm> laughing w/ u btw
lsegal has joined #ruby-lang
slyphon has joined #ruby-lang
<krazyj> what's the correct way to implement a constant for a whole implementation file? for example, line 5 is a constant used in line 6 and 21: http://screencast.com/t/mEBXsAyXr1
brushbox1 has joined #ruby-lang
<zenspider> can you stop submitting screengrabs of text? it's really annoying
michael_mbp has joined #ruby-lang
<countskm> se acabo
fayimora has joined #ruby-lang
esad has joined #ruby-lang
<andrewvos> krazyj: That's ok I suppose. Or just move it up to class level and name it like a constant. LIKE_THIS
<krazyj> andrewvos: thank you sir
<andrewvos> krazyj: And listen to zenspider. He can come off a bit rude sometimes but is generally quite helpful ;)
fgomez has joined #ruby-lang
<countskm> totally off topic... if u dig cuban timba check it out: http://www.youtube.com/watch?v=F_34oDF6ZIs
<krazyj> if anyone wants to critique my first gem and tell me how sucky it is D: https://github.com/joshavant/geopoint-temp
<krazyj> * :D
<countskm> krazyj: u have exposed urself to the wolves ;-)
<krazyj> haha
<krazyj> i'm in the process of cleaning up and readying it for primetime but that's the code, at least
<countskm> ah u are literally just creating the skeleton?
<krazyj> hmm wait. some directories didn't make it up
<krazyj> two file gem, yeah
<andrewvos> I'm off night x.
<zenspider> I shouldn't ever have to call finalize...
<zenspider> the API should take care of everything for me
<krazyj> you open a file by initializing an instance
<zenspider> See File/IO.open as an example
<krazyj> how am i supposed to know when you're done?
<erikh> eof?
<erikh> or a block (which was probably what zenspider was getting at)
<krazyj> gotcha
kurko_ has joined #ruby-lang
michael_mbp has joined #ruby-lang
<krazyj> should my first two tests in my test file be under `describe GeoPointFactory::Generator#generate do` since they operate test #generate?
<krazyj> s/operate/only
<countskm> whats the difference between a point and a geopoint (just for discussion)
<krazyj> point can be any kind of coordinate system… x/y from -5,5 or, most usefully, a lat/lon on the earth
<krazyj> lat/lons are the geographic coordinate system
<countskm> cool
boxmo has joined #ruby-lang
<krazyj> and geographic could suggest, to some degree, that it's a lat/lon and not a point within a projection
<krazyj> basically, i wanted to make a factory for generating test data when using RGeo
<krazyj> useful stuff… not points in the ocean
<countskm> thats cool... anytime u truly have a need for a factory its cool
<countskm> they can save countless lines of static code that shall later not be so static :-)
<krazyj> yup
<krazyj> and looking forward to developing with this too… i can load in a map of San Francisco and, as i'm building/debugging, walk around town and see live, changing test data