Class: Prosereflect::Text
- Defined in:
- lib/prosereflect/text.rb
Constant Summary collapse
- PM_TYPE =
'text'
Class Method Summary collapse
Instance Method Summary collapse
- #text_content ⇒ Object
-
#to_h ⇒ Object
Override the to_h method to include the text attribute.
Methods inherited from Node
#add_child, #find_all, #find_children, #find_first, #initialize, #marks, #marks=, #parse_content, #process_attrs_data, #raw_marks, #to_yaml
Constructor Details
This class inherits a constructor from Prosereflect::Node
Class Method Details
.create(text = '', marks = nil) ⇒ Object
18 19 20 |
# File 'lib/prosereflect/text.rb', line 18 def self.create(text = '', marks = nil) new(text: text, marks: marks) end |
Instance Method Details
#text_content ⇒ Object
22 23 24 |
# File 'lib/prosereflect/text.rb', line 22 def text_content text || '' end |
#to_h ⇒ Object
Override the to_h method to include the text attribute
27 28 29 30 31 |
# File 'lib/prosereflect/text.rb', line 27 def to_h result = super result['text'] = text result end |