Sha256: a69b5f9ca884452dcb22b86c43cba2e9658bfe178206f87c7079af62b9740657
Contents?: true
Size: 647 Bytes
Versions: 16
Compression:
Stored size: 647 Bytes
Contents
module Surrounded module Context class Negotiator identity = "__send__|object_id" instance_methods.each do |meth| unless meth.to_s =~ /#{identity}/ undef_method meth end end private def initialize(object, behaviors) @object, @behaviors = object, behaviors end def method_missing(meth, *args, &block) if @behaviors.instance_methods.include?(meth) the_method = @behaviors.instance_method(meth) the_method.bind(@object).call(*args, &block) else @object.send(meth, *args, &block) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems