Module: RubyGaurden::Bindings

Extended by:
ActiveSupport::Concern
Included in:
Bed
Defined in:
lib/ruby_gaurden/bindings.rb

Instance Method Summary collapse

Instance Method Details

#bind(target, proc = -> {}) ⇒ Object



36
37
38
# File 'lib/ruby_gaurden/bindings.rb', line 36

def bind(target, proc = -> {})
  context.attach(target, proc)
end

#initializeObject



26
27
28
29
30
31
32
33
34
# File 'lib/ruby_gaurden/bindings.rb', line 26

def initialize(*)
  super

  self.class.bindings.each do |target, proc|
    bind target, lambda { |*args|
      instance_exec(*args, &proc)
    }
  end
end