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



173
174
175
# File 'lib/input_sequencer.rb', line 173

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

Instance Method Details

#do_runObject



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/input_sequencer.rb', line 177

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