Class: Sinicum::Jcr::Dam::Document
- Defined in:
- lib/sinicum/jcr/dam/document.rb
Overview
Public: Wrapper around documents stored in Magnolia’s DAM workspace.
Direct Known Subclasses
Constant Summary collapse
- FINGERPRINT_VERSION =
"2"
Constants inherited from Node
Node::ARRAY_CHILD_NODE_PATTERN, Node::BOOL_FALSE_STRING_VALUE, Node::BOOL_TRUE_STRING_VALUE, Node::IMPLICIT_ARRAY_REGEX, Node::ISO_8601_DATE_REGEX, Node::ISO_8601_REGEX, Node::METADATA_NODE_NAME, Node::META_KEY, Node::NODES_KEY, Node::PROHIBITED_JCR_PROPERTIES, Node::PROHIBITED_MGNL_PROPERTIES, Node::PROPERTIES_KEY, Node::SETABLE_JCR_PROPERTIES, Node::SETABLE_MGNL_PROPERTIES
Constants included from NodeQueries
NodeQueries::BINARY_PREFIX, NodeQueries::PATH_DELIMITER, NodeQueries::UUID_PREFIX
Instance Method Summary collapse
- #date ⇒ Object
- #file_name ⇒ Object
- #file_size ⇒ Object
- #mime_type ⇒ Object
- #path(options = {}) ⇒ Object
-
#properties ⇒ Object
Returns a node, which contains the properties of the document.
Methods inherited from Node
#[], #children, #id, #initialize, #inspect, #parent, #persisted?, #to_model, #to_s
Methods included from Mgnl4Compatibility
#mgnl_activatorid, #mgnl_authorid
Constructor Details
This class inherits a constructor from Sinicum::Jcr::Node
Instance Method Details
#date ⇒ Object
39 40 41 |
# File 'lib/sinicum/jcr/dam/document.rb', line 39 def date self[:date1] || updated_at end |
#file_name ⇒ Object
31 32 33 |
# File 'lib/sinicum/jcr/dam/document.rb', line 31 def file_name [properties[:fileName], properties[:extension]].join(".") if properties end |
#file_size ⇒ Object
27 28 29 |
# File 'lib/sinicum/jcr/dam/document.rb', line 27 def file_size properties[:size].to_i if properties end |
#mime_type ⇒ Object
35 36 37 |
# File 'lib/sinicum/jcr/dam/document.rb', line 35 def mime_type properties[:'jcr:mimeType'] if properties end |
#path(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/sinicum/jcr/dam/document.rb', line 17 def path( = {}) converter_name = [:converter].presence || ::Sinicum::Imaging.default_converter_name path = "#{::Sinicum::Imaging.path_prefix}/#{converter_name}#{super}-#{fingerprint}" if properties && properties[:extension].present? path << ".#{properties[:extension]}" end path end |
#properties ⇒ Object
Returns a node, which contains the properties of the document
13 14 15 |
# File 'lib/sinicum/jcr/dam/document.rb', line 13 def properties self[:'jcr:content'] if self[:'jcr:content'] end |