Class: Stupidedi::Builder::StateMachine
- Includes:
- Generation, Navigation, Tokenization, Inspect
- Defined in:
- lib/stupidedi/builder/state_machine.rb
Instance Attribute Summary collapse
- #active ⇒ Array<Zipper::AbstractCursor> readonly
- #config ⇒ Config readonly
Constructors collapse
Instance Method Summary collapse
-
#initialize(config, active) ⇒ StateMachine
constructor
A new instance of StateMachine.
- #pretty_print(q) ⇒ void
- #separators ⇒ Reader::Separators
Methods included from Tokenization
#blank, #composite, #default, #not_used, #repeated
Methods included from Generation
#insert, #read, #remove, #replace
Methods included from Navigation
#count, #count!, #deterministic?, #distance, #element, #elementn, #empty?, #find, #find!, #first, #first?, #iterate, #last, #last?, #next, #parent, #prev, #segment, #segmentn, #sequence, #successors, #zipper
Methods included from Inspect
Constructor Details
#initialize(config, active) ⇒ StateMachine
Returns a new instance of StateMachine.
16 17 18 |
# File 'lib/stupidedi/builder/state_machine.rb', line 16 def initialize(config, active) @config, @active = config, active end |
Instance Attribute Details
#active ⇒ Array<Zipper::AbstractCursor> (readonly)
14 15 16 |
# File 'lib/stupidedi/builder/state_machine.rb', line 14 def active @active end |
#config ⇒ Config (readonly)
11 12 13 |
# File 'lib/stupidedi/builder/state_machine.rb', line 11 def config @config end |
Class Method Details
.build(config) ⇒ StateMachine
46 47 48 |
# File 'lib/stupidedi/builder/state_machine.rb', line 46 def build(config) StateMachine.new(config, InitialState.start.cons) end |
Instance Method Details
#pretty_print(q) ⇒ void
This method returns an undefined value.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/stupidedi/builder/state_machine.rb', line 26 def pretty_print(q) q.text "StateMachine[#{@active.length}]" q.group 2, "(", ")" do q.breakable "" @active.each do |s| unless q.current_group.first? q.text "," q.breakable end q.pp s.node.zipper.node end end end |
#separators ⇒ Reader::Separators
21 22 23 |
# File 'lib/stupidedi/builder/state_machine.rb', line 21 def separators @active.head.node.separators end |