Module: Instancize

Defined in:
lib/instancize.rb

Class Method Summary collapse

Class Method Details

.from_binding(binding) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/instancize.rb', line 2

def self.from_binding(binding)
  locals = binding.local_variables
  locals.each do |variable|
    local = binding.local_variable_get(variable)
    binding.receiver.instance_variable_set("@#{variable}", local)
  end
end