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



144
145
146
# File 'lib/input_sequencer.rb', line 144

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

Instance Method Details

#do_runObject



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/input_sequencer.rb', line 148

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