Class: Stupidedi::Builder::LoopState
Instance Attribute Summary collapse
Instance Method Summary
collapse
#leaf?, lsequence, mkcomposite, mkelement, mkrepeated, mksegment, mksimple, #pretty_print, sequence, tsequence
Methods included from Inspect
#inspect
Constructor Details
#initialize(separators, segment_dict, instructions, zipper, children) ⇒ LoopState
Returns a new instance of LoopState.
21
22
23
24
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 21
def initialize(separators, segment_dict, instructions, zipper, children)
@separators, @segment_dict, @instructions, @zipper, @children =
separators, segment_dict, instructions, zipper, children
end
|
Instance Attribute Details
19
20
21
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 19
def children
@children
end
|
13
14
15
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 13
def instructions
@instructions
end
|
10
11
12
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 10
def segment_dict
@segment_dict
end
|
7
8
9
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 7
def separators
@separators
end
|
16
17
18
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 16
def zipper
@zipper
end
|
Class Method Details
.push(zipper, parent, segment_tok, segment_use, config) ⇒ Zipper::AbstractCursor
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 42
def push(zipper, parent, segment_tok, segment_use, config)
loop_def = segment_use.parent
loop_val = loop_def.empty
segment_val = mksegment(segment_tok, segment_use)
zipper.append_child new(
parent.separators,
parent.segment_dict,
parent.instructions.push(instructions(loop_def)),
parent.zipper.append(loop_val).append_child(segment_val),
[])
end
|
Instance Method Details
#copy(changes = {}) ⇒ LoopState
27
28
29
30
31
32
33
34
|
# File 'lib/stupidedi/builder/states/loop_state.rb', line 27
def copy(changes = {})
LoopState.new \
changes.fetch(:separators, @separators),
changes.fetch(:segment_dict, @segment_dict),
changes.fetch(:instructions, @instructions),
changes.fetch(:zipper, @zipper),
changes.fetch(:children, @children)
end
|