Sha256: 4282077962272014370cc14cdb9866b74cb22020a6a952cd15c914ce5c676371
Contents?: true
Size: 642 Bytes
Versions: 1
Compression:
Stored size: 642 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, behavior) @object, @behavior = object, behavior end def method_missing(meth, *args, &block) if @behavior.instance_methods.include?(meth) the_method = @behavior.instance_method(meth) the_method.bind(@object).call(*args, &block) else @object.send(meth, *args, &block) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
surrounded-0.3.0 | lib/surrounded/context/negotiator.rb |