Class: Pragmater::Processors::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/pragmater/processors/handler.rb

Overview

Handles the insertion or removal of pragma comments.

Constant Summary collapse

DEFAULTS =
{insert: Inserter, remove: Remover}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(processors: DEFAULTS) ⇒ Handler

Returns a new instance of Handler.



9
10
11
# File 'lib/pragmater/processors/handler.rb', line 9

def initialize processors: DEFAULTS
  @processors = processors
end

Instance Method Details

#call(action, comments, body) ⇒ Object



13
# File 'lib/pragmater/processors/handler.rb', line 13

def call(action, comments, body) = processors.fetch(action).new(comments, body).call