Class: Stupidedi::Builder::TableState
- Inherits:
-
AbstractState
- Object
- AbstractState
- Stupidedi::Builder::TableState
- Defined in:
- lib/stupidedi/builder/states/table_state.rb
Instance Attribute Summary (collapse)
- - (Array<AbstractState>) children readonly
- - (InstructionTable) instructions readonly
- - (Reader::SegmentDict) segment_dict readonly
- - (Reader::Separators) separators readonly
- - (Zipper::AbstractCursor) zipper readonly
Constructors (collapse)
Instance Method Summary (collapse)
- - (TableState) copy(changes = {})
-
- (TableState) initialize(separators, segment_dict, instructions, zipper, children)
constructor
A new instance of TableState.
Methods inherited from AbstractState
#leaf?, lsequence, mkcomposite, mkelement, mkrepeated, mksegment, mksimple, #pretty_print, sequence, tsequence
Methods included from Inspect
Constructor Details
- (TableState) initialize(separators, segment_dict, instructions, zipper, children)
A new instance of TableState
21 22 23 24 |
# File 'lib/stupidedi/builder/states/table_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
- (Array<AbstractState>) children (readonly)
19 20 21 |
# File 'lib/stupidedi/builder/states/table_state.rb', line 19 def children @children end |
- (InstructionTable) instructions (readonly)
13 14 15 |
# File 'lib/stupidedi/builder/states/table_state.rb', line 13 def instructions @instructions end |
- (Reader::SegmentDict) segment_dict (readonly)
10 11 12 |
# File 'lib/stupidedi/builder/states/table_state.rb', line 10 def segment_dict @segment_dict end |
- (Reader::Separators) separators (readonly)
7 8 9 |
# File 'lib/stupidedi/builder/states/table_state.rb', line 7 def separators @separators end |
- (Zipper::AbstractCursor) zipper (readonly)
16 17 18 |
# File 'lib/stupidedi/builder/states/table_state.rb', line 16 def zipper @zipper end |
Class Method Details
+ (Zipper::AbstractCursor) push(zipper, parent, segment_tok, segment_use, config)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/stupidedi/builder/states/table_state.rb', line 42 def push(zipper, parent, segment_tok, segment_use, config) case segment_use.parent when Schema::TableDef table_def = segment_use.parent table_val = table_def.empty segment_val = mksegment(segment_tok, segment_use) itable = InstructionTable.build(instructions(table_def)) itable = itable.drop(itable.at(segment_use).drop_count) zipper.append_child new( parent.separators, parent.segment_dict, parent.instructions.push(itable.instructions), parent.zipper.append(table_val).append_child(segment_val), []) when Schema::LoopDef table_def = segment_use.parent.parent table_val = table_def.empty itable = InstructionTable.build(instructions(table_def)) itable = itable.drop(itable.at(segment_use).drop_count) zipper = zipper.append_child new( parent.separators, parent.segment_dict, parent.instructions.push(itable.instructions), parent.zipper.append(table_val).dangle.last, []) LoopState.push(zipper, zipper.node, segment_tok, segment_use, config) end end |
Instance Method Details
- (TableState) copy(changes = {})
27 28 29 30 31 32 33 34 |
# File 'lib/stupidedi/builder/states/table_state.rb', line 27 def copy(changes = {}) TableState.new \ changes.fetch(:separators, @separators), changes.fetch(:segment_dict, @segment_dict), changes.fetch(:instructions, @instructions), changes.fetch(:zipper, @zipper), changes.fetch(:children, @children) end |