module RubyBox::Bindings
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/ruby_box/bindings.rb, line 25 def initialize(*) super self.class.bindings.each do |target, proc| bind target, proc { |*args| instance_exec(*args, &proc) } end end
Public Instance Methods
bindings()
click to toggle source
# File lib/ruby_box/bindings.rb, line 8 def bindings @bindings ||= begin if superclass.respond_to?(:bindings) superclass.bindings.dup else [] end end end
binds(target, proc = Proc.new)
click to toggle source
# File lib/ruby_box/bindings.rb, line 20 def binds(target, proc = Proc.new) bindings << [target, proc] end
Private Instance Methods
bind(target, proc = Proc.new)
click to toggle source
# File lib/ruby_box/bindings.rb, line 35 def bind(target, proc = Proc.new) context.attach(target, proc) end