Skip to content

Instantly share code, notes, and snippets.

@kakutani
Created November 21, 2011 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kakutani/1381490 to your computer and use it in GitHub Desktop.
Save kakutani/1381490 to your computer and use it in GitHub Desktop.
module_extended.rb
module M
def foo
puts "foo!"
end
end
class C
def eigen_class
class << self; self end
end
def extended?(mod)
eigen_class.include?(mod)
end
end
c = C.new
p c.extended?(M) # => false
c.extend(M)
p c.extended?(M) # => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment