Class: AsciiChem::Transform::FormulaNormaliser

Inherits:
Object
  • Object
show all
Defined in:
lib/asciichem/transform.rb

Overview

Lifts the inner nodes of a formula capture into a flat array.

Instance Method Summary collapse

Constructor Details

#initialize(subtree) ⇒ FormulaNormaliser

Returns a new instance of FormulaNormaliser.



272
273
274
# File 'lib/asciichem/transform.rb', line 272

def initialize(subtree)
  @subtree = subtree
end

Instance Method Details

#to_aObject



276
277
278
279
280
281
282
# File 'lib/asciichem/transform.rb', line 276

def to_a
  case @subtree
  when Array then @subtree
  when nil   then []
  else            [@subtree]
  end
end