Sha256: 9eb839e0de365dd68b6a24fa2e6a50411d740f2cc4f808ecf523fa86ff9ee728

Contents?: true

Size: 736 Bytes

Versions: 7

Compression:

Stored size: 736 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

        attr_accessor :line
        def after_initialize!
          self.expand_line = false
          self.to_output = true
          self.to_interactive = true
          if input[0] == NON_EXPANDING_CHARATER
            self.line = input[1..-1].strip
            self.expand_line = false
          else
            self.line = input.strip
            self.expand_line = true
          end
        end

        def lines
          [line]
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gm-notepad-0.0.10 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.9 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.8 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.6 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.5 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.4 lib/gm/notepad/input_handlers/write_line_handler.rb
gm-notepad-0.0.3 lib/gm/notepad/input_handlers/write_line_handler.rb