Gigawiki.com
Include and Extend
2011-05-10 16:23:02
2011-05-10 16:22:10
Autor:
Sony Santos
(sony)
http://gigawiki.com/sony/include-and-extend
Permalink:
http://gigawiki.com/993
language = English, ruby
[XML]
[Impressão]
[Tuitar]
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
Login:
Senha:
Para logar, você precisa ter o Javascript habilitado.
Busca avançada
language = English
Include and Extend
Two ways to simplify Array blocks in Ruby
Ruby autoload like in PHP
My Ruby coding style
attr_reader for class variables
Trying to understand metaclasses
Ruby Coding Style
Internal Frame
language = ruby
Include and Extend
Ruby autoload like in PHP
attr_reader for class variables
Trying to understand metaclasses
Versão desktop