标签:
module MartialArts
def swordsman
puts "I‘m a swordsman."
end
end
class Ninja
include MartialArts
def initialize(clan)
@clan = clan
end
end
class Samurai
include MartialArts
def initialize(shogun)
@shogun = shogun
end
end
module ThePresent
def now
puts "It‘s #{Time.new.hour > 12 ? Time.new.hour - 12 : Time.new.hour}:#{Time.new.min} #{Time.new.hour > 12 ? ‘PM‘ : ‘AM‘} (GMT)."
end
end
class TheHereAnd
extend ThePresent
end
TheHereAnd.now
标签:
原文地址:http://www.cnblogs.com/patientAndPersist/p/4381851.html