class Foo
require 'somegem'
end
class Bar < Foo
def to_s
puts Somegem.somemethod
end
end
Why is this not working/how can I get something like this to work?
class Foo
require 'somegem'
end
class Bar < Foo
def to_s
puts Somegem.somemethod
end
end
Why is this not working/how can I get something like this to work?
$ cat somegem.rb
class Somegem
def self.somemethod
"somemethod"
end
end
$ cat foo.rb
class Foo
require 'somegem'
end
class Bar < Foo
def to_s
puts Somegem.somemethod
end
end
bar = Bar.new()
bar.to_s
$ ruby foo.rb
somemethod
But I'm not exactly sure though, what you tried to accomplish ...