Skip to content

Instantly share code, notes, and snippets.

@cyrilchampier
Last active November 26, 2019 14:21
Show Gist options
  • Save cyrilchampier/92d418ae9bb449bf1b7211e8959d73a7 to your computer and use it in GitHub Desktop.
Save cyrilchampier/92d418ae9bb449bf1b7211e8959d73a7 to your computer and use it in GitHub Desktop.
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