ngtk
11/4/2015 - 3:34 AM

refinements pattern

refinements pattern

class Human
  def say
    puts "hello"
  end
end

module PartyPeople
  refine Human do
    def say
      puts "hooooo!!!"
    end
  end
end


module AnyModule
  using PartyPeople
  bob = Human.new
  puts "bob:"
  bob.say
end

alice = Human.new
puts "alice:"
alice.say