lib/gorillib/utils/console.rb in gorillib-0.4.0pre vs lib/gorillib/utils/console.rb in gorillib-0.4.1pre

- old
+ new

@@ -34,10 +34,13 @@ def inspect() "~#{@obj.inspect}~" ; end def to_s() @obj.to_s ; end alias_method :pretty_inspect, :inspect def methods() @obj.methods ; end + # @returns the proxied object + def __obj__ ; @obj ; end + # These are defined on BasicObject, delegate them along with the rest # BasicObject.instance_methods # => [:==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__, :__id__] def ==( *args, &block) ; __describe_and_send__(:==, *args, &block) ; end @@ -56,10 +59,10 @@ def method_missing(meth, *args, &block) __describe_and_send__(meth, *args, &block) end def __describe_and_send__(meth, *args, &block) - pref = "%-3d %-14s %-15s" % [@call_count, __id__, self.to_s[0..14]] + pref = "%-3d %-14s %-15s" % [@call_count, @obj.__id__, self.to_s[0..14]] @call_count += 1 $stderr.puts "%s %-15s <- %-30s %s -- %s" % [pref, meth.to_s[0..14], args.map(&:inspect).join(','), block, ::Kernel.caller.first] ret = @obj.__send__(meth, *args, &block) $stderr.puts "%s %-15s -> %s" % [pref, meth.to_s[0..14], ret.inspect] if @show_ret ret