Class: Food2Fork::Document
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Food2Fork::Document
- Defined in:
- lib/food2fork/document.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #fields ⇒ Object
-
#initialize(data = {}) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(data = {}) ⇒ Document
Returns a new instance of Document.
12 13 14 15 |
# File 'lib/food2fork/document.rb', line 12 def initialize(data = {}) raise ArgumentError, "Invalid data passed to Document.new: #{data.inspect}" unless data.is_a?(Hash) super(data) end |
Class Method Details
.demodulize(class_name_in_module) ⇒ Object
4 5 6 |
# File 'lib/food2fork/document.rb', line 4 def self.demodulize(class_name_in_module) class_name_in_module.to_s.gsub(/^.*::/, '') end |
Instance Method Details
#fields ⇒ Object
8 9 10 |
# File 'lib/food2fork/document.rb', line 8 def fields @table.keys.map{|k| k.to_s} end |