Include and Extend
2011-05-10 16:23:02
2011-05-10 16:22:10
Autor:
Sony Santos
(sony)
https://gigawiki.com/sony/include-and-extend
Permalink:
https://gigawiki.com/993
language = English, ruby
module Foo
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def bar
puts 'class method'
end
end
def foo
puts 'instance method'
end
end
class Baz
include Foo
end
Please enable JavaScript to view the
comments powered by Disqus.
blog comments powered by
Disqus