lib/input_sequencer.rb in markdown_exec-2.0.4 vs lib/input_sequencer.rb in markdown_exec-2.0.5

- old
+ new

@@ -17,11 +17,11 @@ def initialize(document_filename, initial_blocks = nil) @document_filename = document_filename @current_block = nil @block_queue = initial_blocks - @debug = Env::env_bool('INPUT_SEQUENCER_DEBUG', default: false) ### false e + @debug = Env.env_bool('INPUT_SEQUENCER_DEBUG', default: false) end # Merges the current menu state with the next, prioritizing the next state's values. def self.merge_link_state(current, next_state) MarkdownExec::LinkState.new( @@ -31,13 +31,15 @@ inherited_block_names: next_state.inherited_block_names, inherited_dependencies: next_state.inherited_dependencies, inherited_lines: next_state.inherited_lines, prior_block_was_link: next_state.prior_block_was_link.nil? ? current.prior_block_was_link : next_state.prior_block_was_link ) + # rubocop:disable Style/RescueStandardError rescue pp $!, $@ exit 1 + # rubocop:enable Style/RescueStandardError end # Generates the next menu state based on provided attributes. def self.next_link_state(block_name: nil, display_menu: nil, document_filename: nil, prior_block_was_link: false) @@ -67,11 +69,10 @@ ) exit_when_bq_empty = !bq_is_empty? # true when running blocks from cli; unless "stay" is used loop do break if run_yield(:parse_document, now_menu.document_filename, &block) == :break - pp [__LINE__, 'exit_when_bq_empty', exit_when_bq_empty, '@block_queue', @block_queue, 'now_menu', now_menu] if @debug # self.imw_ins now_menu, 'now_menu' break if exit_when_bq_empty && bq_is_empty? && !now_menu.prior_block_was_link if now_menu.display_menu @@ -79,18 +80,17 @@ run_yield :display_menu, &block choice = run_yield :user_choice, &block if choice.nil? - raise "Block not recognized." + raise 'Block not recognized.' break end break if run_yield(:exit?, choice&.downcase, &block) # Exit loop and method to terminate the app next_state = run_yield :execute_block, choice, &block # imw_ins next_state, 'next_state' - pp [__LINE__, 'next_state', next_state] if @debug return :break if next_state == :break next_menu = next_state else @@ -100,28 +100,28 @@ break if bq_is_empty? # Exit loop if no more blocks to process block_name = @block_queue.shift end # self.imw_ins block_name, 'block_name' - pp [__LINE__, 'block_name', block_name] if @debug next_menu = if block_name == '.' exit_when_bq_empty = false InputSequencer.next_link_state(display_menu: true) else state = run_yield :execute_block, block_name, &block state.display_menu = bq_is_empty? state end - pp [__LINE__, 'next_menu', next_menu] if @debug next_menu # imw_ins next_menu, 'next_menu' end now_menu = InputSequencer.merge_link_state(now_menu, next_menu) end + # rubocop:disable Style/RescueStandardError rescue pp $!, $@ exit 1 + # rubocop:enable Style/RescueStandardError end end return if __FILE__ != $PROGRAM_NAME