Class: Fauxsql::MapWrapper

Inherits:
AttributeWrapper show all
Defined in:
lib/fauxsql/map_wrapper.rb

Instance Attribute Summary

Attributes inherited from AttributeWrapper

#attribute, #name, #options, #record

Instance Method Summary collapse

Methods inherited from AttributeWrapper

#dirty!, #get_nested_record, #initialize

Constructor Details

This class inherits a constructor from Fauxsql::AttributeWrapper

Instance Method Details

#[](key) ⇒ Object



12
13
14
# File 'lib/fauxsql/map_wrapper.rb', line 12

def [](key)
  options[:value_type] ? map[key].send(options[:value_type]) : map[key]
end

#[]=(key, value) ⇒ Object



7
8
9
10
# File 'lib/fauxsql/map_wrapper.rb', line 7

def []=(key, value)
  value = value.send(options[:value_type]) if options[:value_type]
  dirty! { map[key] = value }
end

#delete(key) ⇒ Object



16
17
18
# File 'lib/fauxsql/map_wrapper.rb', line 16

def delete(key)
  dirty! { map.delete(key) }
end