class Ripar::Combinder::BindingWrapper

Forward method calls to bound variables Could probably just use Combinder here. TODO this should be accessing bound_self, right? Variables are accessed anyway by Ruby interpreter because They’re in the binding. Not sure.

Public Class Methods

new( wrapped_binding ) click to toggle source
# File lib/ripar/combinder.rb, line 87
def initialize( wrapped_binding )
  @binding = wrapped_binding
  @binding.extend BindingNiceness
end

Public Instance Methods

method_missing(meth, *args, &blk) click to toggle source
# File lib/ripar/combinder.rb, line 92
def method_missing(meth, *args, &blk)
  ::Kernel.raise "outside variables can't take arguments" if args.size != 0

  if @binding.local_variables.include?( meth )
    @binding.eval meth.to_s
  elsif @binding.self.respond_to? meth
    @binding.self.send meth, *args, &blk
  else
    ::Kernel.raise NoMethodError, "No such outside variable #{meth}"
  end
end
respond_to_missing?( meth, include_all = false ) click to toggle source
# File lib/ripar/combinder.rb, line 104
def respond_to_missing?( meth, include_all = false )
  @binding.local_variables.include?(meth) || @binding.self.respond_to?(meth, include_all)
end