Sha256: 0252682ace2f4778360202602e274d2c4dcf06d84722366994adccf6c350eb25
Contents?: true
Size: 703 Bytes
Versions: 3
Compression:
Stored size: 703 Bytes
Contents
module Osheet::Instance private OSHEET_IVAR_NS = "_osheet_" def get_ivar(name) instance_variable_get(ivar_name(name)) end def set_ivar(name, value) instance_variable_set(ivar_name(name), value) end def push_ivar(name, value) get_ivar(name) << value end def ivar_name(name) "@#{OSHEET_IVAR_NS}#{name}" end def set_binding_ivars(binding) binding.eval('instance_variables'). reject{|ivar| ivar =~ /^@#{OSHEET_IVAR_NS}/}. each do |ivar| # puts "binding #{ivar}: "+binding.eval(ivar).object_id.to_s instance_variable_set(ivar, binding.eval(ivar)) # puts "inst #{ivar}: "+ instance_variable_get(ivar).object_id.to_s end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
osheet-0.7.0 | lib/osheet/instance.rb |
osheet-0.6.0 | lib/osheet/instance.rb |
osheet-0.5.0 | lib/osheet/instance.rb |