Class: MDE

Inherits:
Object show all
Defined in:
lib/input_sequencer.rb

Instance Method Summary collapse

Constructor Details

#initialize(document_filename, initial_blocks = []) ⇒ MDE

extend ImwUx # This makes imw_indent available as a class method include ImwUx # This makes imw_indent available as a class method



139
140
141
# File 'lib/input_sequencer.rb', line 139

def initialize(document_filename, initial_blocks = [])
  @inpseq = InputSequencer.new(document_filename, initial_blocks)
end

Instance Method Details

#do_runObject



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/input_sequencer.rb', line 143

def do_run
  @inpseq.run do |msg, data|
    case msg
    when :parse_document # once for each menu
      # self.imw_ins data, '@ - parse document'
      parse_document(data)
    when :display_menu
      puts "? - Select a block to execute (or type #{$texit} to exit):"
      puts "doc: #{@document_filename}"
      display_menu
    when :user_choice
      $stdin.gets.chomp
    when :execute_block
      # self.imw_ins data, "! - Executing block"
      execute_block(data)
    when :exit?
      data == $texit
    when :stay?
      data == $stay
    else
      raise "Invalid message: #{msg}"
    end
  end
end