Class: Loveseat::DesignDocument::Support
- Inherits:
-
Loveseat::Document::Support
- Object
- Loveseat::Document::Support
- Loveseat::DesignDocument::Support
- Defined in:
- lib/loveseat/design_document/support.rb
Constant Summary
Constants inherited from Loveseat::Document::Support
Loveseat::Document::Support::DEFAULT, Loveseat::Document::Support::TYPE
Instance Attribute Summary
Attributes inherited from Loveseat::Document::Support
Instance Method Summary collapse
- #add_view(name, options = {}) ⇒ Object
- #from_hash(doc) ⇒ Object
-
#initialize(klass, options = {}) ⇒ Support
constructor
A new instance of Support.
Methods inherited from Loveseat::Document::Support
#abstract?, #add_property, #alter_property, #generate_property_map, #singleton?, #to_doc
Constructor Details
#initialize(klass, options = {}) ⇒ Support
Returns a new instance of Support.
4 5 6 7 8 9 |
# File 'lib/loveseat/design_document/support.rb', line 4 def initialize(klass, = {}) super(klass, ) @dsl = DSL.new(self) add_property(:views, Document::Property::Hash, {}) alter_property(:_id, Document::Property::String, DesignDocument.generate_id(klass)) end |
Instance Method Details
#add_view(name, options = {}) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/loveseat/design_document/support.rb', line 17 def add_view(name, = {}) type, default = properties[:views] default.merge!( name => ) end |
#from_hash(doc) ⇒ Object
11 12 13 14 15 |
# File 'lib/loveseat/design_document/support.rb', line 11 def from_hash(doc) object = super(doc) object.views = properties[:views][DEFAULT] object end |