Last active
November 26, 2019 14:21
-
-
Save cyrilchampier/92d418ae9bb449bf1b7211e8959d73a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module KlassIncluded | |
def truc | |
puts "KlassIncluded::truc" | |
super | |
end | |
end | |
module KlassExtended | |
def truc | |
puts "KlassExtended::truc" | |
super | |
end | |
end | |
module KlassPrepended | |
def truc | |
puts "KlassPrepended::truc" | |
super | |
end | |
end | |
class Klass | |
include KlassIncluded | |
extend KlassExtended | |
prepend KlassPrepended | |
def self.truc | |
puts "Klass.self::truc" | |
super | |
end | |
def truc | |
puts "Klass::truc" | |
super | |
end | |
end | |
puts "Klass.ancestors #{Klass.ancestors}" | |
puts Klass.truc | |
puts Klass.new.truc | |
puts "good?" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment