Class: Marker::RecursiveList

Inherits:
ParseNode show all
Defined in:
lib/marker/common.rb

Overview

implements collection methods on a list using a recursive grammar definition requires defining h and r

Direct Known Subclasses

Arguments, List, Markup, Phrase, TextBlock, VerbatimArea

Instance Method Summary collapse

Methods inherited from Treetop::Runtime::SyntaxNode

#present?

Instance Method Details

#rObject



36
37
38
# File 'lib/marker/common.rb', line 36

def r
  nil
end

#single?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/marker/common.rb', line 40

def single?
  r.nil?
end

#to_aObject



28
29
30
31
32
33
34
# File 'lib/marker/common.rb', line 28

def to_a
  if r
    [h] + r.to_a
  else
    [h]
  end
end