Sha256: a280afe8b2e2e6cbc4b410e693ce670ae3e4de37fba72bca28528d9188184e5c
Contents?: true
Size: 525 Bytes
Versions: 24
Compression:
Stored size: 525 Bytes
Contents
require 'test/rails' ## # A wrapper that allows instance variables to be manipulated using +[]+ and # +[]=+ class Test::Rails::IvarProxy ## # Wraps +object+ allowing its instance variables to be manipulated. def initialize(object) @object = object end ## # Retrieves +ivar+ from the wrapped object. def [](ivar) @object.instance_variable_get "@#{ivar}" end ## # Sets +ivar+ to +val+ on the wrapped object. def []=(ivar, val) @object.instance_variable_set "@#{ivar}", val end end
Version data entries
24 entries across 24 versions & 3 rubygems