Also,
p Dog.ancestors
--output:--
[Dog, Cat, Animal, Object, Kernel, BasicObject]
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to
Let's say I call LookupContext with a details hash consisitng of a
format. Here's the sequence as I understand it:
1) First lookup_context.rb is loaded, which means the macros are
called immediately. The register_detail macro, accepts a symbol and
block. We pass it a symbol :formats and a block
class Animal
def greet
puts 'hi'
end
end
class Dog Animal
def greet
super
end
end
d = Dog.new
d.greet
--output:--
hi
module Animal
def greet
puts 'hi'
end
end
class Dog
include Animal
def greet
super
end
end
d = Dog.new
d.greet
--output:--
hi
7stud -- wrote in post #1076203:
Modules that are included are inserted into the inheritance chain.
Where in the chain?
module Cat
def greet
puts 'meow'
end
end
class Animal
def greet
puts 'hi'
end
end
class Dog Animal
include Cat
def greet
super
4 matches
Mail list logo