lib/ripar/roller.rb in ripar-0.0.2 vs lib/ripar/roller.rb in ripar-0.0.3
- old
+ new
@@ -66,11 +66,11 @@
# used by combinder, so must be defined, otherwise it perturbs method_missing
# no point in using respond_to_missing?, because that's part of Object#respond_to,
# not BasicObject
def respond_to?( meth, include_all = false )
- @riven.respond_to?(meth, include_all) || __methods__.include?(meth)
+ @riven.respond_to?(meth, include_all) || __methods__(include_all).include?(meth) || __singleton_methods__(include_all).include?(meth)
end
# make sure this BasicObject plays nicely in pry
def inspect
%Q{#<#{self.__class__} original: #{@original.inspect}, riven: #{@riven.inspect}>}
@@ -83,10 +83,11 @@
def to_s; inspect; end
# include useful methods from Kernel, but rename
define_method :__class__, ::Kernel.instance_method(:class)
define_method :__object_id__, ::Kernel.instance_method(:object_id)
+ define_method :__singleton_methods__, ::Kernel.instance_method(:singleton_methods)
protected
def roll_block( &block )
case block.arity
@@ -98,10 +99,9 @@
::Kernel.raise "Don't know how to handle arity #{block.arity}"
end
end
private
-
- def __methods__
- self.__class__.instance_methods
+ def __methods__( include_all = true )
+ self.__class__.instance_methods include_all
end
end