Class: Stupidedi::Builder::StateMachine
- Inherits:
-
Object
- Object
- 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.
20 21 22 |
# File 'lib/stupidedi/builder/state_machine.rb', line 20 def initialize(config, active) @config, @active = config, active end |
Instance Attribute Details
#active ⇒ Array<Zipper::AbstractCursor> (readonly)
18 19 20 |
# File 'lib/stupidedi/builder/state_machine.rb', line 18 def active @active end |
#config ⇒ Config (readonly)
15 16 17 |
# File 'lib/stupidedi/builder/state_machine.rb', line 15 def config @config end |
Class Method Details
.build(config) ⇒ StateMachine
50 51 52 |
# File 'lib/stupidedi/builder/state_machine.rb', line 50 def build(config) StateMachine.new(config, InitialState.start.cons) end |
Instance Method Details
#pretty_print(q) ⇒ void
This method returns an undefined value.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/stupidedi/builder/state_machine.rb', line 30 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
25 26 27 |
# File 'lib/stupidedi/builder/state_machine.rb', line 25 def separators @active.head.node.separators end |