Class: AsciiChem::Transform::FormulaNormaliser
- Inherits:
-
Object
- Object
- AsciiChem::Transform::FormulaNormaliser
- Defined in:
- lib/asciichem/transform.rb
Overview
Lifts the inner nodes of a formula capture into a flat array.
Instance Method Summary collapse
-
#initialize(subtree) ⇒ FormulaNormaliser
constructor
A new instance of FormulaNormaliser.
- #to_a ⇒ Object
Constructor Details
#initialize(subtree) ⇒ FormulaNormaliser
Returns a new instance of FormulaNormaliser.
205 206 207 |
# File 'lib/asciichem/transform.rb', line 205 def initialize(subtree) @subtree = subtree end |
Instance Method Details
#to_a ⇒ Object
209 210 211 212 213 214 215 |
# File 'lib/asciichem/transform.rb', line 209 def to_a case @subtree when Array then @subtree when nil then [] else [@subtree] end end |