Module: CouchPillow::TypeDirective
- Included in:
- Document
- Defined in:
- lib/couchpillow/directives/type.rb
Instance Method Summary collapse
- #_doc_type ⇒ Object
-
#_sanitize_id(id) ⇒ Object
Helper method to sanitize an id string.
-
#type(value) ⇒ Object
Sets the type of this Document.
Instance Method Details
#_doc_type ⇒ Object
12 13 14 |
# File 'lib/couchpillow/directives/type.rb', line 12 def _doc_type @type ||= "couchpillow" end |
#_sanitize_id(id) ⇒ Object
Helper method to sanitize an id string
19 20 21 22 23 24 25 |
# File 'lib/couchpillow/directives/type.rb', line 19 def _sanitize_id id key = "#{_doc_type}::" id = id.to_s id.start_with?(key) and id = id[key.length..-1] or id end |
#type(value) ⇒ Object
Sets the type of this Document.
7 8 9 |
# File 'lib/couchpillow/directives/type.rb', line 7 def type value @type = value.to_s end |