Sha256: f851bae308938be746b4c2d308ff6ae19626fad70df9d1275d11966b76f86a95

Contents?: true

Size: 601 Bytes

Versions: 8

Compression:

Stored size: 601 Bytes

Contents

require "gm/notepad/input_handlers/default_handler"

module Gm
  module Notepad
    module InputHandlers
      class WriteLineHandler < DefaultHandler
        NON_EXPANDING_CHARATER = '!'.freeze
        def self.handles?(input:)
          true
        end

        def after_initialize!
          if input[0] == NON_EXPANDING_CHARATER
            input.sub!(/^\!/,'')
            expand_line = false
          else
            expand_line = true
          end
          input.render_current_text(to_interactive: true, to_output: true, expand_line: expand_line)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gm-notepad-0.0.18 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.17 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.16 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.15 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.14 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.13 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.12 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.11 lib/gm/notepad/input_handlers/write_line_handler.rb