closer changed the topic of #ruby-core to: check the latest release candidate for 1.9.1 release ftp.ruby-lang.org:/home/yugui/ruby-1.9.1-r26021+1.tar.bz2
Aethenelle has quit [Read error: Connection reset by peer]
dbussink has joined #ruby-core
nokada has joined #ruby-core
hsbt_away has joined #ruby-core
nagachika has joined #ruby-core
<zzak>
[Charlie, irc.freenode.net] benzrf: i believe the problem is that by default popen only opens in "read" mode, meaning it only hijacks the stdout from the child process, not stdin
<zzak>
[Charlie, irc.freenode.net] benzrf: this fixes the problem for me: ruby -e 'puts IO.popen("cat", "r+").read'
<zzak>
[ben z rf, irc.freenode.net] ah, useful
ggherdov has joined #ruby-core
<zzak>
[Charlie, irc.freenode.net] that opens both stdin and stdout of the process
<zzak>
[Charlie, irc.freenode.net] you'll likely then want to use close_write at some point
<zzak>
[ben z rf, irc.freenode.net] kk
<zzak>
[Alexander von Gluck, irc.freenode.net] Q: I'm making a gem to interface with a rest API and turn the results into objects (Think ActiveRecord-like). I just can't figure out a great way to store something at the module level for the Gem... any ideas? I wrote an example gist: https://gist.github.com/avongluck-r1soft/4500a2279f9fc41be0ca698a2284bfa1
madgen_ has joined #ruby-core
<zzak>
[Alexander von Gluck, irc.freenode.net] I want to make a new instance of my gem and set the REST uri at the module level... if that makes sense :-|
<zzak>
[ben z rf, irc.freenode.net] kallisti5: use a constant
<zzak>
[Alexander von Gluck, irc.freenode.net] Right now i'm "CATApi::Breed.all"
<zzak>
[Alexander von Gluck, irc.freenode.net] googles
<zzak>
[ben z rf, irc.freenode.net] kallisti5: when you set "@uri =" in the module block, you're setting one of the *module*'s instance variables
<zzak>
[ben z rf, irc.freenode.net] so of course it won't be visible in the method
<zzak>
[ben z rf, irc.freenode.net] constants, however, are scoped semi-lexically
<zzak>
[Alexander von Gluck, irc.freenode.net] benzrf: is there a way users can define the constant though?
<zzak>
[ben z rf, irc.freenode.net] oh, you want users to be able to supply it
<zzak>
[ben z rf, irc.freenode.net] why not make your thing a class, and then the url is an instance variable?
<zzak>
[ben z rf, irc.freenode.net] (barring that, i *guess* you could do "class << self; attr_accessor :uri; end" in the module)
<zzak>
[Alexander von Gluck, irc.freenode.net] oh.. so pretty much turn the CATAPi module into a class?
madgen has quit [Ping timeout: 260 seconds]
<zzak>
[Alexander von Gluck, irc.freenode.net] That seems to make more sense... I just thought Gem's almost always worked out of modules :-|
<zzak>
[ben z rf, irc.freenode.net] kallisti5: well, they do tend to
<zzak>
[ben z rf, irc.freenode.net] you can put the class in a module, if you want :)
<zzak>
[Alexander von Gluck, irc.freenode.net] lol what's the best practice there? module CATApi -> class CATApi -> class Breed ?
madgen_ has quit [Ping timeout: 252 seconds]
<zzak>
[ben z rf, irc.freenode.net] kallisti5: well, here's a good rule of thumb
<zzak>
[ben z rf, irc.freenode.net] kallisti5: if you're making something a class, you should be able to coherently explain "what" an instance of the class is, and in what circumstances you would instantiate it
<zzak>
[ben z rf, irc.freenode.net] if you're really only defining the class for the features of classes that don't involve instances, you should be making a module
<zzak>
[ben z rf, irc.freenode.net] also, i think it's unusual to nest a class inside another class - normally you nest modules like directories, and then classes are leaves, like files
madgen has joined #ruby-core
<zzak>
[ben z rf, irc.freenode.net] i might be wrong.
<zzak>
[ben z rf, irc.freenode.net] (er, modules can also be leaves)
<zzak>
[purple, irc.freenode.net] can i unzip NUGET package using Ruby ZIP ?
shinnya has joined #ruby-core
rafaelfranca has joined #ruby-core
hsbt_away is now known as hsbt
rafaelfranca has quit [Ping timeout: 240 seconds]
hsbt is now known as hsbt_away
madgen has quit [Ping timeout: 244 seconds]
madgen has joined #ruby-core
rafaelfranca has joined #ruby-core
rafaelfranca has quit [Remote host closed the connection]
rafaelfranca has joined #ruby-core
nagachika has quit [Remote host closed the connection]
hsbt_away is now known as hsbt
shinnya has quit [Ping timeout: 276 seconds]
madgen has quit [Ping timeout: 244 seconds]
madgen has joined #ruby-core
hsbt is now known as hsbt_away
hsbt_away is now known as hsbt
hsbt is now known as hsbt_away
Aethenelle has joined #ruby-core
hsbt_away is now known as hsbt
nagachika has joined #ruby-core
nagachika has quit [Ping timeout: 260 seconds]
hsbt is now known as hsbt_away
hsbt_away is now known as hsbt
hsbt is now known as hsbt_away
hsbt_away is now known as hsbt
hsbt is now known as hsbt_away
rafaelfr_ has joined #ruby-core
rafaelfranca has quit [Ping timeout: 268 seconds]
hsbt_away is now known as hsbt
enebo has quit [Quit: enebo]
hsbt is now known as hsbt_away
rafaelfr_ has quit [Remote host closed the connection]