[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Open4 : undefined method `spawn'

Brian Candler

9/3/2008 1:16:00 PM

> seems strange to me because the method spawn IS defined in the "module
> Open4" (lines 241-320)

"include Mod" gives you access to the instance methods of the module, but
not module methods. See http://www.ruby-doc.org/core/classes/M...

irb(main):001:0> module Foo; def test1; puts "hello"; end; end
=> nil
irb(main):002:0> module Bar; def self.test2; puts "bye"; end; end
=> nil
irb(main):003:0> include Foo
=> Object
irb(main):004:0> include Bar
=> Object
irb(main):005:0> test1
hello
=> nil
irb(main):006:0> test2
NameError: undefined local variable or method `test2' for main:Object
from (irb):6
from :0
irb(main):007:0> Bar.test2
bye
=> nil

So I haven't tried the Open4 gem, but probably you need "Open4.spawn"

Regards,

Brian.