Class: Siteleaf::Document
- Defined in:
- lib/siteleaf/document.rb
Instance Attribute Summary collapse
-
#collection_path ⇒ Object
Returns the value of attribute collection_path.
Attributes inherited from Content
#basename, #body, #created_at, #date, #directory, #filename, #id, #metadata, #path, #permalink, #sha, #site_id, #title, #updated_at, #url, #user_id, #visibility
Attributes inherited from Entity
Instance Method Summary collapse
Methods inherited from Content
#draft?, #hidden?, #site, #to_file, #visible?
Methods inherited from Entity
all, #attributes, #attributes=, class_name, create, delete, #delete, endpoint, #entity_endpoint, find, #identifier, #initialize, #save
Constructor Details
This class inherits a constructor from Siteleaf::Entity
Instance Attribute Details
#collection_path ⇒ Object
Returns the value of attribute collection_path.
4 5 6 |
# File 'lib/siteleaf/document.rb', line 4 def collection_path @collection_path end |
Instance Method Details
#collection ⇒ Object
10 11 12 |
# File 'lib/siteleaf/document.rb', line 10 def collection Collection.find(collection_identifier) end |
#collection_identifier ⇒ Object
14 15 16 |
# File 'lib/siteleaf/document.rb', line 14 def collection_identifier collection_path || directory.match(/_(.*)/).try(:last) end |
#create_endpoint ⇒ Object
6 7 8 |
# File 'lib/siteleaf/document.rb', line 6 def create_endpoint ::File.join("sites", site_id, "collections", collection_identifier, "documents") end |