Class: Gm::Notepad::InputHandlers::CommentHandler

Inherits:
DefaultHandler show all
Defined in:
lib/gm/notepad/input_handlers/comment_handler.rb

Constant Summary collapse

COMMENT_PREFIX =
'#'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DefaultHandler

build_if_handled, #initialize, #lines

Constructor Details

This class inherits a constructor from Gm::Notepad::InputHandlers::DefaultHandler

Class Method Details

.handles?(input:) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/gm/notepad/input_handlers/comment_handler.rb', line 8

def self.handles?(input:)
  return false unless input.match(/^#/)
  true
end

Instance Method Details

#after_initialize!Object



13
14
15
16
17
18
19
# File 'lib/gm/notepad/input_handlers/comment_handler.rb', line 13

def after_initialize!
  input.render_current_text(
    to_interactive: true,
    to_output: false,
    expand_line: false
  )
end