Class: AsciiChem::Model::Text

Inherits:
Node
  • Object
show all
Defined in:
lib/asciichem/model/text.rb

Overview

A run of plain text — operators, whitespace, anything the grammar doesn't promote to a typed node.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#==, #accept, #children, #diagnostic_label, #hash, short_name, #to_cml, #to_html, #to_latex, #to_mathml, #to_svg, #to_text

Constructor Details

#initialize(content:) ⇒ Text

Returns a new instance of Text.



10
11
12
# File 'lib/asciichem/model/text.rb', line 10

def initialize(content:)
  @content = content
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



8
9
10
# File 'lib/asciichem/model/text.rb', line 8

def content
  @content
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/asciichem/model/text.rb', line 18

def to_s
  "Text(#{content.inspect})"
end

#value_attributesObject



14
15
16
# File 'lib/asciichem/model/text.rb', line 14

def value_attributes
  { content: content }
end