Class: Dato::StructuredText
- Defined in:
- app/components/dato/structured_text.rb
Instance Attribute Summary collapse
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
-
#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 |
# 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 end |
Instance Attribute Details
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
22 23 24 |
# File 'app/components/dato/structured_text.rb', line 22 def blocks @blocks end |
#overrides ⇒ Object (readonly)
Returns the value of attribute overrides.
24 25 26 |
# File 'app/components/dato/structured_text.rb', line 24 def overrides @overrides end |
Instance Method Details
#root ⇒ Object
18 19 20 |
# File 'app/components/dato/structured_text.rb', line 18 def root self end |