Class: ContentBlockTools::InternalContentPath
- Inherits:
-
Object
- Object
- ContentBlockTools::InternalContentPath
- Defined in:
- lib/content_block_tools/internal_content_path.rb
Overview
Represents the path to internal content within a content block
An internal content path identifies a specific piece of content within a content block’s details hash. The path is used with ‘dig` to traverse the nested structure.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #block_name ⇒ Object
- #block_type ⇒ Object
-
#initialize(path) ⇒ InternalContentPath
constructor
A new instance of InternalContentPath.
- #present? ⇒ Boolean
- #singular? ⇒ Boolean
Constructor Details
#initialize(path) ⇒ InternalContentPath
Returns a new instance of InternalContentPath.
29 30 31 |
# File 'lib/content_block_tools/internal_content_path.rb', line 29 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
27 28 29 |
# File 'lib/content_block_tools/internal_content_path.rb', line 27 def path @path end |
Instance Method Details
#block_name ⇒ Object
45 46 47 |
# File 'lib/content_block_tools/internal_content_path.rb', line 45 def block_name path.last end |
#block_type ⇒ Object
41 42 43 |
# File 'lib/content_block_tools/internal_content_path.rb', line 41 def block_type path.first end |
#present? ⇒ Boolean
33 34 35 |
# File 'lib/content_block_tools/internal_content_path.rb', line 33 def present? path.any? end |
#singular? ⇒ Boolean
37 38 39 |
# File 'lib/content_block_tools/internal_content_path.rb', line 37 def singular? path.one? end |