Class: OpenStruct
- Inherits:
-
Object
- Object
- OpenStruct
- Defined in:
- lib/mongomapper_ext/types/open_struct.rb
Class Method Summary collapse
Class Method Details
.from_mongo(value) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/mongomapper_ext/types/open_struct.rb', line 12 def self.from_mongo(value) if value.kind_of?(self) value else OpenStruct.new(value || {}) end end |
.to_mongo(value) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/mongomapper_ext/types/open_struct.rb', line 4 def self.to_mongo(value) if value.kind_of?(self) value.send(:table) else value end end |