Skip to content

Instantly share code, notes, and snippets.

@crystalneth
Created April 27, 2011 17:12
Show Gist options
  • Save crystalneth/944711 to your computer and use it in GitHub Desktop.
Save crystalneth/944711 to your computer and use it in GitHub Desktop.
module Bar
def bar
puts "bar"
end
end
class Foo
include Bar
bar
end
@crystalneth
Copy link
Author

$ ruby test.rb
test.rb:9:in <class:Foo>': undefined local variable or methodbar' for Foo:Class (NameError)
from test.rb:7:in `

'

@makkura
Copy link

makkura commented Apr 27, 2011

Perhaps you're looking for something like:

irb(main):013:0> class Test
irb(main):014:1> def self.test_me
irb(main):015:2> puts "testing!"
irb(main):016:2> end
irb(main):017:1> test_me
irb(main):018:1> end
testing!
=> nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment