ngtk
11/4/2015 - 4:07 AM

monkey patch pattern

monkey patch pattern

class Human
  def say
    puts "hello"
  end
end

module AnyModule
  class ::Human
    def say
      puts "hooooo!!!"
    end
  end

  bob = Human.new
  puts "bob:"
  bob.say
end

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