Class: Dato::StructuredText
- Defined in:
- app/components/dato/structured_text.rb
Instance Attribute Summary collapse
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
-
#overrides ⇒ Object
readonly
Returns the value of attribute overrides.
Instance Method Summary collapse
-
#initialize(structured_text_node, overrides: {}) ⇒ StructuredText
constructor
A new instance of StructuredText.
- #root ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(structured_text_node, overrides: {}) ⇒ StructuredText
Returns a new instance of StructuredText.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/components/dato/structured_text.rb', line 4 def initialize(structured_text_node, overrides: {}) unless structured_text_node.is_a?(Hashie::Mash) raise ArgumentError.new("The parameter is not an instance of Hashie::Mash") end unless structured_text_node.value.schema == "dast" raise ArgumentError.new("The node schema is '#{structured_text_node.value.schema}' instead of 'dast'") end @overrides = overrides.with_indifferent_access @structured_text_node = structured_text_node @blocks = structured_text_node.blocks @links = structured_text_node.links end |
Instance Attribute Details
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
23 24 25 |
# File 'app/components/dato/structured_text.rb', line 23 def blocks @blocks end |
#links ⇒ Object (readonly)
Returns the value of attribute links.
24 25 26 |
# File 'app/components/dato/structured_text.rb', line 24 def links @links end |
#overrides ⇒ Object (readonly)
Returns the value of attribute overrides.
26 27 28 |
# File 'app/components/dato/structured_text.rb', line 26 def overrides @overrides end |
Instance Method Details
#root ⇒ Object
19 20 21 |
# File 'app/components/dato/structured_text.rb', line 19 def root self end |