Class: Fictive::Syntax::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/fictive/syntax.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, text = nil) ⇒ Element

Returns a new instance of Element.



9
10
11
12
13
# File 'lib/fictive/syntax.rb', line 9

def initialize(type, text = nil)
  @type = type
  @text = text
  @children = []
end

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



7
8
9
# File 'lib/fictive/syntax.rb', line 7

def children
  @children
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/fictive/syntax.rb', line 6

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/fictive/syntax.rb', line 6

def type
  @type
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/fictive/syntax.rb', line 15

def empty?
  @children.empty?
end