Re: Open4 : undefined method `spawn'

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,
not module methods. See

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
=> 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
=> nil

So I haven’t tried the Open4 gem, but probably you need “Open4.spawn”



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs