Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
<andrewvos> zenspider: I don't know. I'm trying something new, and so far it feels good.
<zenspider> tho honestly... I'd rather have Feature
<zenspider> with a class method, parse
jimmy1980 joined #ruby-lang
<andrewvos> Maybe I'm too stuck up on SRP.
<steveklabnik> hahahah
<andrewvos> But I feel like the model Feature (which is a mongo_mapper module) is not the correct place for that.
<steveklabnik> 'maybe i work too hard sometimes
<steveklabnik> 'maybe i care too much about my job'
<steveklabnik> 'maybe i follow srp too strictly'
<steveklabnik> ;)
<andrewvos> :)
<zenspider> I like having the behavior on the responsible party. Features should be able to parse themselves.
<zenspider> this is something that comes from smalltalk, where everything can output itself as code, and read itself back in
<zenspider> it's something that ruby seriously lacks
<zenspider> our inspect output is chump
<steveklabnik> homoiconic-ish
<andrewvos> awesome_print is nice
<zenspider> it's a cultural thing that ingrains itself deeply.
<zenspider> _everything_ in smalltalk can output itself as code... including code.
<zenspider> so when you export your code to a file, you just ask it to and out comes calls to import methods with their source
looopy joined #ruby-lang
flip_digits joined #ruby-lang
<rue> FeatureParser -> ParsesFeatures -> ParseFeatures
<andrewvos> zenspider: In large systems, don't you find the noun naming convention to break down a lot?
<rue> features = ParseFeatures.from this_text_file_here
<steveklabnik> andrewvos: there are _lots_ of nouns.
<steveklabnik> :)
<rue> steveklabnik: 4?
<steveklabnik> rue: at least!
<andrewvos> rue: False. 5.
<rue> No, lots is 4
<rue> One, two, many, lots
jimmy1980 joined #ruby-lang
WillMarshall joined #ruby-lang
<rue> I find that super-literate programming style is 73% more efficient in separating concerns
<injekt> is banister still banned here?
<rue> Yes
<injekt> kk
<injekt> also fu airports
<erikh> when did he get banned?
<injekt> yesterday perhaps?
<injekt> or maybe the previous day
<andrewvos> recently
<rue> He hasn't learned his lesson yet
<injekt> my plane isn't even here and people are lining up
<injekt> i hate people
<oddmunds> you could try herding them
<injekt> like a sheep dog?
<oddmunds> like lassie would
<injekt> sounds like something that has a high success rate
flip_digits joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
looopy_ joined #ruby-lang
xhx joined #ruby-lang
ognevsky joined #ruby-lang
gregmoreno joined #ruby-lang
banisterfiend joined #ruby-lang
j`ey joined #ruby-lang
<RomyEatsDrupal> hi… anyone here also have some experience in scala?
<zenspider> #scala
RomyEatsDrupal joined #ruby-lang
igotnolegs joined #ruby-lang
QaDeS_ joined #ruby-lang
slyphon joined #ruby-lang
<crankharder> anyone know a good way of removing all items from an array whos mode == 1?
Rakko joined #ruby-lang
<zenspider> reject, reject!, or delete_if should do you
<zenspider> ri Array and ri Enumerable
<zenspider> ri is your friend(tm)
<ReinH> unsure why Array needs both reject! and delete_if
<zenspider> ReinH: don't you start
<steveklabnik> havent you read that ruby-{talk,core} thread?
<steveklabnik> Y SO MANY ALIASES????1
<ReinH> haven't
<ReinH> but I will say
<ReinH> having aliases for other things but not include? -> includes? is ridiculous
<steveklabnik> folwer's rule, satisfied: http://martinfowler.com/bliki/HumaneInterface.html
<steveklabnik> rue: agreed.
<steveklabnik> errr, ReinH
<ReinH> heh
<zenspider> I tried to get them to correct the English of some of the names way back when and I got "ruby is not english" as the response... I tried to argue that ruby uses english, so it should use proper english, but nothin'
livinded joined #ruby-lang
<ReinH> Ruby should do a better job of respecting my grammar CDO
<steveklabnik> :)
<steveklabnik> ReinH: ActiveGrammar?
<ReinH> heh
<steveklabnik> wow, that'd be a great gem, actually.
<steveklabnik> lol
<ReinH> zenspider: at least you tried...
<zenspider> yeah
<ReinH> would that be some horrendous approach to writing a lexer?
<Rakko> yeah, if the word 'include' isn't inflected for 3rd-person singular, 'is_a' shouldn't be either
<steveklabnik> ActiveGrammar could use i18n to only alias if you're in certain locales.
<steveklabnik> heh
ryanf joined #ruby-lang
zcdny joined #ruby-lang
<zcdny> Hi, there, who know the iRC channel of THOR ?
<andrewvos> zcdny: There probably isn't one. RAAARRR
<drbrain> #asgard ?
<ReinH> heh
<andrewvos> So much for going to sleep early tonight :(
amh345 joined #ruby-lang
wmoxam joined #ruby-lang
<amh345> im having a synchronization issue. i have a method that writes a file and than right after i have another method that encrypts it. I'm finding that if there is a lot of data being written/appended to the file it doesn't complete being written to HDD before the encryption starts. resulting in only partial data encryption. what is the best way to handle this?
<steveklabnik> mutex.
artOfWar joined #ruby-lang
ognevsky left #ruby-lang
* steveklabnik shrugs
<andrewvos> amh345: Encrypt the file *while* writing it.
<mksm> amh345, close the file before encrypting
<zenspider> amh345: a system call to sync will flush disk caches... but that should be transparent to userland processes
<zenspider> haha. that too
<mksm> now he's confused :D
<mksm> but helped
<drbrain> I would encrypt the file while writing it
<andrewvos> Right sleepy time.
<amh345> i like the idea of encrypting while writing. can that be done with GPG?
<amh345> how would one even encrypt while writing?
<andrewvos> amh345: By encrypting small chunks of data and writing them when a certain buffer size is reached.
lightcap joined #ruby-lang
stepnem joined #ruby-lang
<ReinH> amh345: incremental cryptography
muzone joined #ruby-lang
<amh345> the content that is being written is in an .each. data_to_write.each ……. at the end of the each i append that content to a file.
<amh345> hey ReinH
<ReinH> hey
<ReinH> the real question is: why are you encrypting *after* writing?
<amh345> the idea of encrypting while writing is pretty cool. and awesome for security. is there any ruby specific googlefu terms i could look for? we're getting into territory that is totally unknown for me
<ReinH> no matter what you do you'll still be susceptible to timing attacks
<amh345> ReinH: exactly
<ReinH> read the file, modify in memory, encrypt, write
<yfeldblum> what's the attack?
<amh345> no attack. only potential
<ReinH> read the file before after it's written and before it's encrypted
gregmore_ joined #ruby-lang
<ReinH> s/before after/after
<amh345> ReinH: so you're saying right to memory?
<amh345> store*
<ReinH> encrypt in process
<drbrain> amh345: a) use OpenSSL to do whatever your encrypting program does
<yfeldblum> hmm ... a good implementation of a good cipher should typically not be susceptible to timing attacks
<ReinH> if you care enough to encrypting in the first place, you should never be writing the data unencrypted to the filesystem
<drbrain> amh345: b) if your encrypting program accepts data from stein, pipe to it
<yfeldblum> that being part of the criteria for judging goodness
<ReinH> yfeldblum: if you're encrypting the file after it's written it will always be susceptible
dv310p3r joined #ruby-lang
<ReinH> drbrain: ofc that presents MITM vectors
<yfeldblum> yes, so encrypt blocks before writing them
<ReinH> yfeldblum: right
<amh345> ReinH: i know. right now i've been relying on a very quick write and ecrypt. but it's not solid. obviously. im trying to automate now do i can make it run smoother and more secure.
<drbrain> yfeldblum: filesystem timing attacks to grab the unencrypted data, not timing attacks to expose secret bits
<ReinH> drbrain: Not sure about piping. I wouldn't trust sending unencrypted data to one fd any more than another
dreinull joined #ruby-lang
<drbrain> ReinH: yeah, you'd also have to be careful about exec() and so on
<drbrain> to make sure that exec() is running the right program
<ReinH> would be easy to link hijack
<ReinH> well not easy
<ReinH> but another vector you have to consider
<amh345> ReinH: are you avail yet for freelance? like writing what your saying i need to do here?
<ReinH> amh345: heh no, just got hired :p
<amh345> damnit!
<ReinH> :(
<amh345> i missed the window :)
<ReinH> totes
<amh345> is what you're saying i need to do for this encrypt a big deal?
<ReinH> amh345: depends on how big a deal the encryption is
<ReinH> and what vectors you need to consider
resetexistence joined #ruby-lang
<amh345> i need to find some ruby specific info on this on the googles
<ReinH> in general I would avoid writing unencrypted bits anywhere in userspace
<ReinH> it's considerably harder to scrub active memory
<ReinH> so keeping them in process is basically fine
<amh345> in honesty, im having a a rough time understanding the process here.
<ReinH> if you're encrypting something, do it in the Ruby process
<ReinH> not by writing somewhere or piping somewhere
<amh345> ok, so i write to a process (need to google that) and than gpg that data stored in the process?
<drbrain> amh345: what are you using for the encryption part?
<drbrain> ah, gpg
<amh345> gpg. i've been sent a key
<drbrain> amh345: use https://rubygems.org/gems/gpgme
<drbrain> this one has "easy" in the name, which is why I recommend it :D
<erikh> there's also gpgr
<amh345> oh nice. are you aware if it can do this encrypting for a process thing?
<amh345> fwiw, i've got the key and all that jazz functioning (not that it was difficult :))
<drbrain> amh345: your program is a "process"
<amh345> it looks like about about to learn my next level of ruby.
artOfWar joined #ruby-lang
<erikh> pro tip: if you jump over the flagpole at the end of it you'll find the secret warp zone
<amh345> haha
artOfWar joined #ruby-lang
edwardsharp joined #ruby-lang
mbriggs joined #ruby-lang
Pip joined #ruby-lang
artOfWar joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
andrewhl joined #ruby-lang
stepnem joined #ruby-lang
hahuang65 joined #ruby-lang
<macmartine_> How do I get this string: "2011-12-05 17:00:00", where this is local time, to a time in utc?
jkyle joined #ruby-lang
igotnolegs joined #ruby-lang
banisterfiend joined #ruby-lang
<amh345> Time.parse("2011-12-05 17:00:00").getutc
<amh345> oh they left!
Pip joined #ruby-lang
Pip joined #ruby-lang
slackstation joined #ruby-lang
nofxx joined #ruby-lang
gregmoreno joined #ruby-lang
tallship joined #ruby-lang
Bwild joined #ruby-lang
arooni-mobile joined #ruby-lang
amerine joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
takaokouji joined #ruby-lang
gregmoreno joined #ruby-lang
frode15243 joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
towski joined #ruby-lang
cjs226 joined #ruby-lang
woollyams joined #ruby-lang
macmartine joined #ruby-lang
artOfWar joined #ruby-lang
banisterfiend joined #ruby-lang
resetexistence joined #ruby-lang
jimmy1980 joined #ruby-lang
jbwiv_ joined #ruby-lang
kitallis joined #ruby-lang
gokulnath joined #ruby-lang
<jbwiv_> how can one tell all classes which subclass a particular class through introspection?
<banisterfiend> jbwiv_: can you reword that in english ? :P
looopy joined #ruby-lang
<banisterfiend> jbwiv_: ClassA < ClassB #=> true, then ClassA subclasses ClassB
jimmy1980 joined #ruby-lang
x0F__ joined #ruby-lang
banisterfiend joined #ruby-lang
srbaker joined #ruby-lang
banister_ joined #ruby-lang
RomD` joined #ruby-lang
Ruthenium joined #ruby-lang
banisterfiend joined #ruby-lang
jimmy1980 joined #ruby-lang
tenderlove joined #ruby-lang
flip_digits joined #ruby-lang
Weems joined #ruby-lang
<headius> drbrain: did you get a chance to release updated rdoc + rdoc-data for 1.8.7 and 1.9.3?
<drbrain> headius: hrm, no!
<drbrain> I forgot
<headius> ah-ha!
<headius> while you're at it, you could add a note about jruby to that post-install notice
<headius> since on jruby you'll always need to install rdoc-data
<drbrain> sure
<headius> grazie!
JosephRuby joined #ruby-lang
ryanf joined #ruby-lang
Pip joined #ruby-lang
Natch| joined #ruby-lang
Aphelion joined #ruby-lang
looopy joined #ruby-lang
heppy joined #ruby-lang
jimmy1980 joined #ruby-lang
ryanf joined #ruby-lang
dr0id joined #ruby-lang
robbyoconnor joined #ruby-lang
Locke23rus joined #ruby-lang
looopy joined #ruby-lang
robbyoconnor joined #ruby-lang
frangiz joined #ruby-lang
cylence joined #ruby-lang
kitallis joined #ruby-lang
flip_digits joined #ruby-lang
amerine joined #ruby-lang
Natch| joined #ruby-lang
Nisstyre joined #ruby-lang
edwardsharp joined #ruby-lang
io_syl joined #ruby-lang
lightcap joined #ruby-lang
artOfWar joined #ruby-lang
yxhuvud joined #ruby-lang
jimmy1980 joined #ruby-lang
amh345 left #ruby-lang
hahuang65 joined #ruby-lang
densebits joined #ruby-lang
JohnBat26 joined #ruby-lang
solars joined #ruby-lang
headius joined #ruby-lang
jxie joined #ruby-lang
nuclearsandwich joined #ruby-lang
<shevy> hmm what would be better
<shevy> foo.gsub!(/something/,'')
<shevy> vs
<shevy> foo.gsub!(/something/,'') if foo.include? 'something'
<Ruthenium> first
<shevy> hmm but why?
<densebits> seems redundant
<shevy> wouldn't the second way be somewhat faster than the first, as the regex engine would not be invoked?
<havenn> shevy: then just: foo.delete('something') # =P
<shevy> .delete works differently
<shevy> "hello hello".delete "lo" # => "he he"
<shevy> "hello hello".gsub! /lo/,'' # => "hel hel"
<havenn> shevy: kk, hrm, how bout: "hello hello".gsub! 'lo',''
<shevy> indeed
<shevy> though I thought it was about .delete. I am already using gsub, I am just curious whether .include? is worth to be used before calling .gsub
<shevy> I am going to go with what is common
<shevy> the first!
<densebits> I guess it would depend on the use case.
<Ruthenium> anyway
<Ruthenium> >ruby
<Ruthenium> >speed
workmad3 joined #ruby-lang
livinded joined #ruby-lang
Neil joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
aroop joined #ruby-lang
naz joined #ruby-lang
workmad3 joined #ruby-lang
heppy joined #ruby-lang
alip joined #ruby-lang
dc5ala joined #ruby-lang
Mchl joined #ruby-lang
yorickpeterse joined #ruby-lang
dr_bob joined #ruby-lang
burgestrand joined #ruby-lang
Defusal joined #ruby-lang
Defusal joined #ruby-lang
cyri_ joined #ruby-lang
solars joined #ruby-lang
gnufied joined #ruby-lang
<manveru> >> "abcd".delete('bd')
<manveru> => "ac"
molgrew joined #ruby-lang
roadkith joined #ruby-lang
heppy joined #ruby-lang
ryanf joined #ruby-lang
saLOUt joined #ruby-lang
Manhose joined #ruby-lang
uniqanomaly_ joined #ruby-lang
Pupeno joined #ruby-lang
Pupeno joined #ruby-lang
tla joined #ruby-lang
heftig joined #ruby-lang
mytrile joined #ruby-lang
<mytrile> Hey, guys. I want to parse a line of Gemfile and get the name of the gem and the version. I've tried like this but I want to merge that into one regex - https://gist.github.com/54ea7c7fb1349c0e5f74
michael_mbp joined #ruby-lang
Manhose_ joined #ruby-lang
lenilson_dias joined #ruby-lang
Locke23rus_ joined #ruby-lang
adambeynon joined #ruby-lang
Pip joined #ruby-lang
Pip joined #ruby-lang
Locke23rus joined #ruby-lang
<manveru> oh my
Locke23rus joined #ruby-lang
Locke23rus joined #ruby-lang
jimmy1980 joined #ruby-lang
benanne joined #ruby-lang
woollyams joined #ruby-lang
<shevy> hmmm
<shevy> I am very proud of myself now
<shevy> I have moved all german umlauts into a standalone yaml file
<shevy> now let's see for ruby 1.9.x ...
<shevy> ansicolour.rb:24: warning: duplicated when clause is ignored
<shevy> now if it would just tell me which one is duplicated precisely...
zmack joined #ruby-lang
thrcka joined #ruby-lang
skade joined #ruby-lang
looopy joined #ruby-lang
<shevy> hmm can someone confirm:
<shevy> - a,b: foobar
<shevy> is valid yaml
<shevy> - ,b: foobar
Fiel joined #ruby-lang
<shevy> is invalid
<shevy> correct?
jensn joined #ruby-lang
Fiel joined #ruby-lang
kvs joined #ruby-lang
jasox joined #ruby-lang
<hipe_> shevy: a quick check in irb with Psych::VERSION "1.0.0" confirms your findings -- the latter returns a Psych::SyntaxError
kleech_ joined #ruby-lang
<kleech_> Is there any difference between Devise::friendly_token and Devise.friendly_token, both would call the same class method? (I'm only using Devise as an example)
<hipe_> kleech_: iirc Foo::bar is syntactic sugar for Foo.bar which i'm not particularly fond of ;)
<hipe_> so, no
<kleech_> Thanks, but do you "so, yes" i.e they are the same? (ie. always same the result)
<hipe> constants must have a leading capitalized first letter, but method names need not so it can lead to some confusing magic
<hipe> :D no there is no difference, yes they are the same (according to my extensive 20 seconds of playing with in in irb)
<kleech_> hipe: Thanks - Just sugar :)
<kleech_> Any ideas - Given a hash how do I remove all keys not in an array of keys? Using hash.select returns an Array.
<Ruthenium> convert it back to hash
<kleech_> Ruthenium: I tried .to_h and to_hash neither methods exist, is there some other way?
<Ruthenium> Hash#[]
<Ruthenium> though Hash#select returns hash for me
<kleech_> Ruthenium: Perfect thanks - re: select, I'm using 1.8, are you using 1.9?
<Ruthenium> yep
jimmy1980 joined #ruby-lang
<shevy> thanks hipe
workmad3 joined #ruby-lang
gix- joined #ruby-lang
michael_mbp_ joined #ruby-lang
hebz0rl joined #ruby-lang
Locke23rus joined #ruby-lang
jimmy1980 joined #ruby-lang
beiter joined #ruby-lang
car joined #ruby-lang
rohit joined #ruby-lang
Xzyx987X joined #ruby-lang
Manhose joined #ruby-lang
Spooner joined #ruby-lang
Pip joined #ruby-lang
oddmunds joined #ruby-lang
takaokouji joined #ruby-lang
vmatiyko joined #ruby-lang
adambeynon joined #ruby-lang
Indian joined #ruby-lang
vmatiyko left #ruby-lang
sepp2k joined #ruby-lang
vmatiyko joined #ruby-lang
vmatiyko left #ruby-lang
xhx joined #ruby-lang
Spooner joined #ruby-lang
vmatiyko joined #ruby-lang
vmatiyko left #ruby-lang
fridim_ joined #ruby-lang
car left #ruby-lang
<muzone> morning yall
* muzone sprinkles coffee around the place as if it was champagne
beiter joined #ruby-lang
* shevy sprinkles dirt on muzone as if he was needing it
<muzone> hhhhhhh :P
<muzone> we're talking road dirt though right?
<muzone> or maybe mud wrestling with your wife?
<muzone> while you're jerking off in the corner
<muzone> lol nah
<muzone> that one went too far
hebz0rl joined #ruby-lang
rohit left #ruby-lang
<shevy> muzone I just took the dirt around your cold corpse :>
cjs226 joined #ruby-lang
roadkith_ joined #ruby-lang
malev joined #ruby-lang
wmoxam joined #ruby-lang
robbyoconnor joined #ruby-lang
saLOUt joined #ruby-lang
wyhaines joined #ruby-lang
roadkith joined #ruby-lang
xhx joined #ruby-lang
imperator joined #ruby-lang
yalue joined #ruby-lang
fvollero joined #ruby-lang
<imperator> hm, RbConfig::CONFIG['COMMON_HEADERS'] is empty on osx
tommyvyo joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
DEac- joined #ruby-lang
<imperator> huh, not set on linux either, wtf
<imperator> they've been screwing with it
skade joined #ruby-lang
toretore joined #ruby-lang
jimmy1980 joined #ruby-lang
leopard_me joined #ruby-lang
RomD` joined #ruby-lang
gearaholic joined #ruby-lang
<shevy> ["COMMON_HEADERS", ""],
<shevy> ["COMMON_LIBS", ""],
<shevy> ["COMMON_MACROS", ""],
<shevy> hmm on 1.8.7 is also empty
jimmy1980 joined #ruby-lang
AlHafoudh joined #ruby-lang
robbrit joined #ruby-lang
dv310p3r joined #ruby-lang
<imperator> didn't used to be
<imperator> at least i don't think they were
yfeldblum joined #ruby-lang
Neil joined #ruby-lang
<Defusal> Brb is officially one of the worst gems i have used :/
<Defusal> It could really do with some love
<Defusal> I've been working around issues, using my own reconnecting logic, even though it shouldnt randomly disconnect or disconnect repeatedly for no reason, requiring the app to be restarted
<Defusal> but now it made ruby 1.9.2 segfault :|
<Defusal> sure its unlikely that it alone caused the segfault, and its probably related to EM, but EM has never segfaulted with any other code, heh
jensn joined #ruby-lang
<imperator> EM?
<roadkith> eventmachine?
jimmy1980 joined #ruby-lang
michael_mbp joined #ruby-lang
cyri_ joined #ruby-lang
scottschecter joined #ruby-lang
floyd2 joined #ruby-lang
mantono joined #ruby-lang
ddfreyne joined #ruby-lang
<dreinull> so droplr runs on 1.9.3 - and it throws an error
mitchty joined #ruby-lang
heftig joined #ruby-lang
nofxx joined #ruby-lang
Indian joined #ruby-lang
adambeynon joined #ruby-lang
wmoxam joined #ruby-lang
DEac- joined #ruby-lang
xhx joined #ruby-lang
madsheep joined #ruby-lang
lsegal joined #ruby-lang
rippa joined #ruby-lang
jimmy1980 joined #ruby-lang
thrcka joined #ruby-lang
<imperator> apparently redirecting $stdout goofs up system()
<samuelkadolph> I highly doubt that
<imperator> doesn't return true or false if it's redirected
<samuelkadolph> imperator: Yes it does
<samuelkadolph> Why do you think p will work if you redirect $stdout?
<samuelkadolph> And that's not actually a redirect of $stdout
<imperator> oh, right, duh
macmartine joined #ruby-lang
<samuelkadolph> ruby -e 'o = $stdout.clone; r,w = IO.pipe; $stdout.reopen(w); o.puts(system("ls").inspect); o.puts(r.rad)' # true
<samuelkadolph> Err, not the o.puts(r.rad) part
<imperator> can't use pipes here, gotta work on winders
<imperator> unless, hm, does IO.pipe work on windows? can't remember now
<samuelkadolph> Yes it does
Pupeno- joined #ruby-lang
<imperator> k, thanks
<samuelkadolph> It returns nil instead of false for system("ls") but it does work
rayners joined #ruby-lang
xhx joined #ruby-lang
thrcka joined #ruby-lang
looopy joined #ruby-lang
outoftime joined #ruby-lang
scampbell joined #ruby-lang
<imperator> $stdout = fake = StringIO.new isn't a redirect? how not?
FrozenProduce joined #ruby-lang
FrozenProduce left #ruby-lang
tomzx joined #ruby-lang
<rue> It doesn't affect the actual stdout
<rue> That's really only a problem with Readline and so on, in some cases
kmeehl joined #ruby-lang
MistyM joined #ruby-lang
<imperator> what does it do then?
jkyle joined #ruby-lang
<rue> It just reassigns what the global variable $stdout points to?
<rue> So long as your code uses $stdout, directly or indirectly, that's fine
<imperator> oh, you mean i'm not affecting STDOUT, just $stdout
<rue> Even more specifically, not the actual fd, but yes
envygeeks joined #ruby-lang
jimmy1980 joined #ruby-lang
jensn_ joined #ruby-lang
<rue> I don't even know what the problem space is, or whether you need to, but that's why it's not really a redirect :)
<envygeeks> I'm a bit confused at how caller(n) is working: it just doesn't seem to be lining up with what the docs say https://gist.github.com/40ee771de1b307a30723
roha joined #ruby-lang
gregmore_ joined #ruby-lang
shyouhei joined #ruby-lang
shevy joined #ruby-lang
yfeldblum joined #ruby-lang
dabradley joined #ruby-lang
<rue> envygeeks: That's not #caller(n)
cogman joined #ruby-lang
<envygeeks> rue: elaborate please because the docs show def a(skip); caller(skip); end
<envygeeks> even ri shows that caller when called in a procedural style is the same as Klass#caller
io_syl joined #ruby-lang
io_syl joined #ruby-lang
comboy joined #ruby-lang
Manhose joined #ruby-lang
<rue> Your pastie has caller.join
<rue> Which is to say, caller().join
Silowyi joined #ruby-lang
<envygeeks> because caller(10) returns an array still so I join it to add numbers :P
<samuelkadolph> imperator: assigning an IO to $stdout isn't the same as redirecting $stdout, it's just replacing a global variable in ruby.
<envygeeks> and it still has the same problem no matter what, it's start is WAY off
<shevy> long live ruby!
wyhaines_ joined #ruby-lang
Pupeno joined #ruby-lang
Pupeno joined #ruby-lang
vesan joined #ruby-lang
wyhaines joined #ruby-lang
wyhaines joined #ruby-lang
RomD`` joined #ruby-lang
slaytanic joined #ruby-lang
looopy joined #ruby-lang
nofxx joined #ruby-lang
heppy joined #ruby-lang
Natch| joined #ruby-lang
Pip joined #ruby-lang
Pip joined #ruby-lang
leonL joined #ruby-lang
burgestrand joined #ruby-lang
thrcka joined #ruby-lang
<envygeeks> yeah I definitely have to be missing something with caller that or this is a bug: https://gist.github.com/52417114ab754181d526
andrewhl joined #ruby-lang
<rue> envygeeks: Read the doc again
<envygeeks> rue: Returns the current execution stack—an array containing strings in the form “file:line” or “file:line: in `method’”. The optional start parameter determines the number of initial stack entries to omit from the result. is plain english, and that example shows it not working
<rue> caller(start=1) -> array or nil
Tref joined #ruby-lang
<burgestrand> Try invoking it with 0
<burgestrand> … or in fact any parameter except 1 :p
<envygeeks> ah yeah I see now
<envygeeks> it's pry and irb corrupting the stack somehow because doing what you guys said with 0, 1 and 2 showed it working but in pry and irb it fails miserably and the count is off
<envygeeks> without pry and irb caller(2) works but in irb and pry I still get: https://gist.github.com/40ee771de1b307a30723
cylence joined #ruby-lang
<burgestrand> envygeeks: that’s because the line needs to be processed and finally executed, if you look through the stack you’ll notice that on top of it lies the line where pry runs the command
<burgestrand> same with IRB
<envygeeks> is there no way to avoid that? Not trying to fight just trying to understand it so I can figure out how to work around it when I'm testing in pry
<burgestrand> I’m not sure what kind of stacktrace you are expecting
gregmoreno joined #ruby-lang
<envygeeks> well I was testing my Kernel.raise adjustment that would throw a user into pry when a raise is brought up, and I was in Kernel messing about playing with caller to /try/ and see how my function saw it, but it turns out they see caller 2 different ways
<envygeeks> because I remove my Kernel.raise from the caller and send off the caller from before the point I called parent_raise
thegeekinside joined #ruby-lang
<burgestrand> envygeeks: https://github.com/pry/pry/issues/349 :)
<burgestrand> appears it’s been addressed already
<envygeeks> hmmm...I'm on the latest HEAD
<envygeeks> So I'll have to tell him about it tonight and see if he can look into it more
<burgestrand> Latest HEAD as in latest pry installed from GitHub after that issue was closed?
<burgestrand> (just saying, since the latest version from rubygems is released at november 5th, long before that issue)
<envygeeks> Yessum :P my pry updates whenever they push a new update because I'm using the new hooks and helping to test and break binding_of_caller and stack-explorer
<envygeeks> (via git)
kitallis joined #ruby-lang
<envygeeks> ah nevermind I read the commit which explains it better
<envygeeks> I need to use the backtrace command in pry and not caller, using backtrace will show me how my method sees it
<envygeeks> wait, no
<envygeeks> now I'm confused
<envygeeks> nevermind, I'll just beat up banister later tonight about it
soulnafein joined #ruby-lang
srbaker joined #ruby-lang
slackstation joined #ruby-lang
tenderlove joined #ruby-lang
Pip joined #ruby-lang
<shevy> yay
<shevy> some snuggling and cuddling right envygeeks
<envygeeks> I'm gonna light the fury! No not really, I'll probably forget by then since I've had a rough day already because it's been so busy here but meh
Neil_ joined #ruby-lang
Austin__ joined #ruby-lang
Austin__ left #ruby-lang
Austin__ joined #ruby-lang
lightcap joined #ruby-lang
lsegal joined #ruby-lang
<envygeeks> wait, what does tap(&:shift) do?
thone_ joined #ruby-lang
<samuelkadolph> The same thing as shift
edwardsharp joined #ruby-lang
fridim_ joined #ruby-lang
Oloryn_lt1 joined #ruby-lang
slant joined #ruby-lang
jbwiv_ joined #ruby-lang
rushed joined #ruby-lang
slaytanic joined #ruby-lang
shevy joined #ruby-lang
tallship joined #ruby-lang
scampbell joined #ruby-lang
alexkane joined #ruby-lang
yorickpeterse joined #ruby-lang
ndch joined #ruby-lang
ttilley joined #ruby-lang
hahuang65 joined #ruby-lang
amerine joined #ruby-lang
slaytanic joined #ruby-lang
root_ joined #ruby-lang
<root_> could someone help me with this ruby script?
heppy joined #ruby-lang
Carnage\ joined #ruby-lang
gregmoreno joined #ruby-lang
benanne joined #ruby-lang
elijahc joined #ruby-lang
lightcap joined #ruby-lang
yxhuvud joined #ruby-lang
shivamib joined #ruby-lang
thrcka joined #ruby-lang
ryanf joined #ruby-lang
Dreamer3 joined #ruby-lang
<rue> Help how? Apart from telling you to use literals instead of {Array,Hash}.new?
<rue> And indentation :?
nuclearsandwich joined #ruby-lang
Tref joined #ruby-lang
leopard__ joined #ruby-lang
solars joined #ruby-lang
<ironcamel> what's the best cms written in ruby?
<steveklabnik> i like refinery, but it's rough around the edges in places.
<steveklabnik> and there arent tons of plugins yet.
<steveklabnik> but i feel it's the best anyway.
<ironcamel> don't care about plugins. themes/templates i care about.
<shevy> hmm rails rails rails
<envygeeks> rails is for wimps, do it the hard way and build it from the ground up and then show your muscle
<envygeeks> and don't use new relic either, I expect pure manual debugs
butchanton joined #ruby-lang
kitallis joined #ruby-lang
darkf joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
heppy joined #ruby-lang
heppy_ joined #ruby-lang
jasox joined #ruby-lang
Jake232 joined #ruby-lang
<shevy> envygeeks working on it!
sepp2k joined #ruby-lang
tekin joined #ruby-lang
tekin joined #ruby-lang
brianpWins joined #ruby-lang
* imperator releases mkmf-lite 0.2.2 into the wild
nuclearsandwich joined #ruby-lang
jkyle_ joined #ruby-lang
<Asher> does it have the feature of not sucking like mkmf?
phlipper joined #ruby-lang
<drbrain> Asher: how does mkmf suck?
<Asher> how does mkmf not suck?
<Asher> flat file structure is one of the big places
<steveklabnik> heh
<Asher> mkmf is a gigantic mess
floyd2 joined #ruby-lang
<drbrain> Asher: it doesn't have a flat file structure, I fixed that last week
<Asher> hah well i'm not up to date on last week's then
<drbrain> Asher: … maybe you should submit some feature requests on redmine so I can fix them
<drbrain> :D
<headius> how do you raise the right Errno exception given an int value in hand...from Ruby
<headius> i.e. something I get back from FFI
<drbrain> headius: rb_sys_fail() I think
<headius> from Ruby
<headius> I think you're right from C
<drbrain> oh, from ruby
<Asher> drbrain - didn't know anyone actually paid attention to such things… i've inquired before and no one seemed interested… i'll keep that in mind
jensn joined #ruby-lang
<drbrain> Asher: also, there's documentation: http://paste.segment7.net/oy.html
<Asher> hm? i've seen the docs, at least i thought...
resetexistence joined #ruby-lang
<headius> huh, can there really be no way?
<drbrain> headius: I'm tracing
<imperator> Asher, it's a module, with methods meant to be mixed in, generally for use in conjunction with ffi
<imperator> i separate out the compiled code using templates and erb
<imperator> instead of the big ball of mud that mkmf uses
<headius> drbrain: oh, I just stumbled onit...SystemCallError.new does it for you
<imperator> and it doesn't emit crap to stdout or stderr
<Asher> drbrain - oh the big annoyance i had was the use of relative paths as the base path caused gdb to get confused in xcode… having ../../../../ at the beginning of every path
lianj joined #ruby-lang
<headius> >> SystemCallError.new(3)
<headius> => #<Errno::ESRCH: No such process>
<headius> a little weird, but ok
<drbrain> sweet
<imperator> headius, not cross platform though i don't thin
<imperator> k
<headius> what's not x-platform about it?
fayimora joined #ruby-lang
<headius> ignore the fact that I just used '3' there
<steveklabnik> headius: doesn't JRUby's jit emit jvm bytecode?
<imperator> won't get the same errors on windows
<headius> I have a real errno from an FFI call
<steveklabnik> right?
FiXato joined #ruby-lang
Pip joined #ruby-lang
<imperator> iirc
<headius> steveklabnik: when it JITs or AOTs
<imperator> although....i think they hacked it so you do in MRI
<drbrain> imperator: it should be fine if he uses a platform-local errno
* imperator can't remember now
jmontross joined #ruby-lang
<drbrain> if you get a C EAGAIN it'll map through just fine to Errno::EGAGAIN
<drbrain> gah,
<drbrain> autocorrect ☹
<rue> ELADYGAGAGAIN
<headius> yeah, that's the situation here
<imperator> nice
<headius> I'm not hardcoding any values
<headius> steveklabnik: looks like enebo updated it too
<imperator> drbrain, yeah, i was thinking of errmap in win32.c
mrsolo joined #ruby-lang
<steveklabnik> yeah, just saw that.
<steveklabnik> gotta defend jruby's honor on the internets <3
<headius> thank you!
workmad3 joined #ruby-lang
jasox joined #ruby-lang
<shevy> hmmm
<shevy> webmin is kinda neat
<shevy> does ruby have something like webmin?
<envygeeks> it intrigues me somebody says: "Ruby has gems, or libraries" which implies PHP does not, when it does...
<imperator> does php have anything like gems?
<steveklabnik> PEAR
<shevy> and APPLES
<imperator> shevy, dunno, wouldn't be surprised, but i don't know of anything offhand
<imperator> what's webmin written in? perl?
<shevy> yeah
<shevy> I like the idea behind it
<shevy> kinda crazy hehe
<shevy> that updated "asymptote" via apt-get
<shevy> :D
zmack joined #ruby-lang
vikoren joined #ruby-lang
vikoren joined #ruby-lang
Weems joined #ruby-lang
<headius> I heart you FFI
<MistyM> FFI makes my life blissful and full of rainbows and puppies.
<yxhuvud> headius: what is the normal way of doing stuff like that in java?
<headius> it's not possible
<yxhuvud> how unconvenient
<headius> indeed!
<headius> but jruby works miracles
<samuelkadolph> headius: I love FFI because I used it to automate logging into a javascript only website
<headius> ok, you'll have to explain that one :)
<rue> A cyborg?
workmad3 joined #ruby-lang
rippa joined #ruby-lang
Oloryn_lt1 joined #ruby-lang
SuperTaz joined #ruby-lang
<samuelkadolph> I wanted to rewrite my xbox gamertag api but I can't find a sinatra async library for jruby. Aspen doesn't work for me.
<headius> ahhh
lightcap joined #ruby-lang
<samuelkadolph> I have it running with node.js right now but it's soooo slow for screen scraping live.xbox.com. But it would need to be async since the website is also slow to respond.
<samuelkadolph> And it broke with their redesign. lol
floyd2 joined #ruby-lang
lianj joined #ruby-lang
lianj joined #ruby-lang
marcostoledo joined #ruby-lang
flip_digits joined #ruby-lang
lightcap joined #ruby-lang
nofxx joined #ruby-lang
gearaholic joined #ruby-lang
<headius> that figures
<gearaholic> is there a way to determin a files mime type?
<steveklabnik> binary/octet-stream ;)
<steveklabnik> you can use http://mime-types.rubyforge.org/ too
<gearaholic> thanks
<manveru> gearaholic: you can try ffi-magic
<headius> FFI!!
<manveru> of course
thrcka joined #ruby-lang
<gearaholic> thanks, i'll give ffi a try
skammer joined #ruby-lang
curtism joined #ruby-lang
sodani1 joined #ruby-lang
<sodani1> could someone show me an example of a single-value parameter vs multi-value parameter?
<manveru> a who?
<manveru> what kind of value?
<jmontross> maybe … {:key => "value"} vs {:key1 => "value1", :key2 => "value2"}
<manveru> that's an hash, not a parameter
<jmontross> a parameter can be a hash.
saLOUt joined #ruby-lang
<samuelkadolph> There are no such things are multi-value parameters in ruby
<sodani1> so a parameter always has to be a single object?
<Asher> but you can get the illusion by using a hash as the last parameter
<Asher> in which case you can pass multiple hash key/value pairs implicitly
looopy joined #ruby-lang
<shevy> illusion!
<shevy> I dispel your illusion!
<shevy> what do you say to that!
<Asher> *poof*?
<jmontross> i did say maybe.
<shevy> hmm
<shevy> I should try to use FFI one day
<jmontross> object with a few params.. it's kinda what he meant though it was semantically 'an illusion'
<shevy> I think he is drunk
<shevy> right sodani1
<shevy> illuuuuuuusions
<shevy> they are all around us
<shevy> multi-value illusions
<shevy> lisp inside ruby illusion
Axsuul joined #ruby-lang
<manveru> headius: looks like it won't run on jruby right now
<manveru> does travis have some option to run with --1.9 ?
<headius> hmmm, I thought they did
<manveru> hm, might be able to work around that
<headius> yeah, looks like it's simply 1.9
<manveru> ah, they take JRUBY_OPTS
<envygeeks> just remove the -jruby and you'll be good to skip jruby
<manveru> why would i wanna skip jruby?
<envygeeks> sorry I read that wrong I got confused by the JRUBY opts and the first part >.<
<envygeeks> I meant to just give you an example of a version specific travis
jensn joined #ruby-lang
<manveru> headius: how do you mean?
<manveru> something like jruby-19mode would be nice
Heimidal joined #ruby-lang
<manveru> oh, great, rbx 1.9 misses Open3.spawn
<headius> I thought they were going to add 1.9 jruby to travis
<envygeeks> they did do: `env: JRUBY_OPTS=' ---1.9'
<manveru> that'll run all specs again with that env var though?
<envygeeks> hmmm...I don't quite remember I know there is a good example of it here: https://github.com/dkubb/veritas/blob/master/.travis.yml
<manveru> wut
<manveru> wtf did they smoke
<envygeeks> yeah it's mad confusing
fayimora joined #ruby-lang
<manveru> ah, exclude
<manveru> oh well, no CI on jruby 1.9 for me then
<manveru> can't be bothered to maintain that
<envygeeks> the issue involving that is still open though so you should make your comment: https://github.com/travis-ci/travis-ci/issues/101
<manveru> now just gotta hunt down the rbx issue
edwardsharp joined #ruby-lang
burgestrand joined #ruby-lang
<rue> It went that way!
RomyEatsDrupal joined #ruby-lang
<manveru> don't be ruediculus
workmad3 joined #ruby-lang
michael_mbp joined #ruby-lang
diegoviola joined #ruby-lang
s0ber joined #ruby-lang
y3llow joined #ruby-lang
workmad3 joined #ruby-lang
senj joined #ruby-lang
Heimidal_ joined #ruby-lang
woollyams joined #ruby-lang
postmodern joined #ruby-lang
robbrit left #ruby-lang
<shevy> rue is like Clint Eastwood - in Finland
jimmy1980 joined #ruby-lang
<Asher> clint eastwood minus being in finland?
<shevy> sure minus
<shevy> it's cold up there
<Asher> eastwood's finnish films just aren't as good
<shevy> lol
Tref joined #ruby-lang
saLOUt joined #ruby-lang
s0ber joined #ruby-lang
y3llow joined #ruby-lang
y3llow joined #ruby-lang
dimebar joined #ruby-lang
Manhose joined #ruby-lang
Heimidal joined #ruby-lang
jimmy1980 joined #ruby-lang
<erikh> he's got a hipster stache
gix joined #ruby-lang
<jasox> what in File::open( 'idea-' + idea_name + '.txt', 'w' ) do |f| , |f| means ?
<rane_> block variable
<rane_> print it
<rane_> and use File.open
<epitron> jasox: |f| is the open file... when code inside the "do/end" finishes, f will automatically be cleaned up for you
<epitron> you don't have to close the file handle
<jasox> thanks guy, i get it now
<jasox> guys*
<epitron> ruby usually lets you do that when it's something that has to be cleaned up
<epitron> or something you only need temporarily
workmad3 joined #ruby-lang
<epitron> hahah
<epitron> that is a crazy book
<jasox> :D
<kith> so |f| is the content of the file not a file handler right?
<jasox> this example is even better Dir['idea-*.txt'].each do |file_name|
<epitron> no, |f| is a file object
<kith> a file handler then?
<kith> f.readlines
<epitron> something like that :)
<kith> kinda like?
<epitron> yep
<kith> k
<rue> It's a File
<epitron> tastylines = open("filename") { |f| f.lines.map(&:strip).reject{|line| line.blank? }
<epitron> }
<epitron> or, for extra fun: module Enumerable; def tastylines; lines.map(&:strip).reject{|line| line.blank? }; end; end
<epitron> now everything will have a tastylines!
<epitron> (if it's got a lines method)
<kith> what the difference between "its a file" and "its a file handler"?
<epitron> file handler is not the right term
<kith> oh okay
<epitron> file HANDLE is what an operating system gives you
<epitron> it's a number that tells you a file you just opened
<epitron> and you have to close it, or the program will eventually run out of file handles
<epitron> (there's a maximum number you can have open at once)
<kith> ah
<epitron> a handler is something that handles files...
<epitron> i dunno what that would do
<epitron> a file object is a wrapper around a file handle
<kith> i was assuming its a file handler because many ruby programmers seem to like "fh = File.open"
<kith> or fd for file descriptor?
<epitron> *handle
<epitron> not handler :)
<kith> ah
<epitron> yes, fd is file descriptor
<epitron> an fd is the technical unix term
<kith> i see
<epitron> handlers are something else
<jasox> Going back to c++ after ruby is hilarious.
<jasox> :D
<epitron> you got event handlers, interrupt handlers, signal handlers, exception handlers...
<kith> so the file handler is part of the filesystem?
<epitron> generally they're methods that catch events and figure out how to handle them
<rue> Let's forget about file handlers
<epitron> i suppose the OS must have a handler for events that come from the filesystem :)
<epitron> which would dispatch them to the appropriate listeners
<kith> i see
<rue> If you like, we can talk about file descriptors, or objects of the File class
<epitron> eg: that OSX program that indexes all your files
<epitron> interrupt handlers are part of every program, and they listen for operating system instructions
<epitron> like: QUIT NOW
<epitron> or: USER HIT ^C
<epitron> no wait, those are signal handlers
<rue> *facedesk*
<epitron> interrupt handlers are for hardware events
<epitron> every time your hardware clock ticks, it sends the operating system an interrupt
<kith> interesting what difference a single "r" can make :D
<epitron> every time you press a key on the keyboard, you get a keyboard interrupt, and the keyboard handler handles it
<epitron> yep!
<epitron> well, there's a difference between a pot handle and a pot handler
<epitron> big difference!
<epitron> anyhow, if you ever see "fh = open", change it to "open { |f| "
<epitron> fh is a silly name
jmontross joined #ruby-lang
<jasox> what is better to use do or {
<epitron> it's up to coding conventions
<steveklabnik> {} for one liners. do/end for multi-line
<epitron> most people use {} for quick oneliners
<jmontross> yeah… greater than one line use do is my rule
<epitron> i find, in EventMachine, i use multiline { } because it lets me differentiate callbacks from loops
<epitron> loops will be do/end
<erikh> filehandles are silly indeed
<erikh> just use descriptors
<erikh> that's how real men do it
solars joined #ruby-lang
<epitron> jasox: also: {} can't handle hash arguments without parens
<epitron> eg:
<epitron> thing :with=>"args" { }
<epitron> ^- errorn!!!!!!!!!!!
<epitron> so, you gotta either add ()'s, or do/end it
<rue> Any arguments
<epitron> orly?
<epitron> no, do/end works
<erikh> do/end isn't { }, is it?
<erikh> OH OH OH IT'S MAAAAAGIC
<jmontross> depends.
<epitron> rue: you see people doing that for oneliners sometimes: method :arg=>:arg do lalala end
<jmontross> a = {}; a is an empty hash. [1,2].each {|i| puts i } it is do/end…
<rue> I'm sure you do
<epitron> it's ugly, imo :)
<rue> But, again, you must use parens with *any* arguments if you have a {}-block.
jcf joined #ruby-lang
<epitron> oh right :)
<rue> It's just because the two have different precedence
<epitron> unless you wanna: method arg, arg, &proc { }
<epitron> i've done things like that before, when you need many callbacks
<epitron> usually as a hash
<epitron> this is all parsers' fault...
* epitron would enjoy a language where you press a hotkey to define a block, and it's serialized to disk in some kind of unambiguous format
<erikh> like source code?
voker57 joined #ruby-lang
voker57 joined #ruby-lang
<epitron> no, more like an object database
<erikh> I think oracle tried that
<epitron> orly
<erikh> yeah i'm trying to remember the name of it
<erikh> baiscally a CGI interface to sql
heppy joined #ruby-lang
<erikh> it's pretty much complete ass
<epitron> hahah
<epitron> web browsers are gross
<erikh> yes.
<epitron> it was thinking more along the lines of a special editor that can interface with the code database
<erikh> I just wrote a mini-rvm for work
<epitron> orly
<epitron> is it better than rvm?
<erikh> haha no.
<erikh> it just doesn't have to work so hard for a pleasing user interface
<epitron> hahah
<epitron> rbenv lite
hagabaka joined #ruby-lang
nofxx joined #ruby-lang
jimmy1980 joined #ruby-lang
dejongge joined #ruby-lang
imperator joined #ruby-lang
singpoly1a joined #ruby-lang
Skif joined #ruby-lang
scottschecter joined #ruby-lang
Heimidal_ joined #ruby-lang
looopy joined #ruby-lang
jimmy1980 joined #ruby-lang
resetexistence joined #ruby-lang
JosephRuby joined #ruby-lang
looopy_ joined #ruby-lang
tenderlove joined #ruby-lang
petercooper joined #ruby-lang
Spooner joined #ruby-lang
roha joined #ruby-lang
<jmontross> so is event-machine a fancy wrapper around Threads?
benanne joined #ruby-lang
<manveru> jmontross: no
<epitron> event-machine is a wrapper around select/kqueue/poll/epoll
Heimidal joined #ruby-lang
scottschecter joined #ruby-lang
tomzx joined #ruby-lang
WillMarshall joined #ruby-lang
thenagain joined #ruby-lang
thenagain joined #ruby-lang
StevenRingo joined #ruby-lang