Class: Rephrase::FakeNode

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

Overview

Class for faking a node

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, children) ⇒ FakeNode

Initializes a FakeNode.

Parameters:

  • type (Symbol)

    node type

  • children (Array)

    child nodes



32
33
34
35
# File 'lib/rephrase.rb', line 32

def initialize(type, children)
  @type = type
  @children = children
end

Instance Attribute Details

#childrenArray (readonly)

Node children

Returns:

  • (Array)


27
28
29
# File 'lib/rephrase.rb', line 27

def children
  @children
end

#typeSymbol (readonly)

Node type

Returns:

  • (Symbol)


23
24
25
# File 'lib/rephrase.rb', line 23

def type
  @type
end

Class Method Details

.iter_scope(children) ⇒ Object

Constructs a FakeNode with type :ITER_SCOPE.

Parameters:

  • children (Array)

    child nodes



17
18
19
# File 'lib/rephrase.rb', line 17

def self.iter_scope(children)
  new(:ITER_SCOPE, children)
end

.list(children) ⇒ Object

Constructs a FakeNode with type :LIST_EMBEDDED.

Parameters:

  • children (Array)

    child nodes



11
12
13
# File 'lib/rephrase.rb', line 11

def self.list(children)
  new(:LIST_EMBEDDED, children)
end