Method: Contract#deserialize

Defined in:
lib/rubysol/contract.rb

#deserialize(state_data) ⇒ Object Also known as: load



263
264
265
266
267
268
269
270
271
272
# File 'lib/rubysol/contract.rb', line 263

def deserialize(state_data)  
  state_data.each do |name, value|
    ## todo/fix: make sure ivar is_a? Typed!!!!
    ## lookup type info
    definition = self.class.state_variable_definitions[ name ]
    type  = definition[:type]
    typed = type.new( value )    ## note: always (re)create new typed classes (from literals)
    instance_variable_set( "@#{name}", typed )
  end
end