Class: RicherText::Nodes::Text
- Inherits:
-
RicherText::Node
- Object
- RicherText::Node
- RicherText::Nodes::Text
- Defined in:
- lib/richer_text/nodes/text.rb
Constant Summary
Constants inherited from RicherText::Node
Instance Attribute Summary
Attributes inherited from RicherText::Node
#attrs, #children, #json, #type
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(json) ⇒ Text
constructor
A new instance of Text.
- #text ⇒ Object
Methods inherited from RicherText::Node
Constructor Details
#initialize(json) ⇒ Text
Returns a new instance of Text.
4 5 6 7 |
# File 'lib/richer_text/nodes/text.rb', line 4 def initialize(json) @marks = json.fetch("marks", []).map { |mark| RicherText::Mark.new(mark) } super(json) end |
Instance Method Details
#accept(visitor) ⇒ Object
13 14 15 |
# File 'lib/richer_text/nodes/text.rb', line 13 def accept(visitor) visitor.visit_text(self, @marks) end |
#text ⇒ Object
9 10 11 |
# File 'lib/richer_text/nodes/text.rb', line 9 def text json["text"] end |