Class: RailsPipeline::SubscriberHandler::BaseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-pipeline/handlers/base_handler.rb

Direct Known Subclasses

ActiveRecordCRUD, Logger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload, target_class: nil, envelope: nil, event_type: nil) ⇒ BaseHandler

Returns a new instance of BaseHandler.



6
7
8
9
10
11
12
13
14
15
# File 'lib/rails-pipeline/handlers/base_handler.rb', line 6

def initialize(payload, target_class: nil, envelope: nil, event_type: nil)
  @payload = payload
  @target_class = target_class
  @envelope = envelope
  if envelope
    @event_type = envelope.event_type
  else
    @event_type = event_type
  end
end

Instance Attribute Details

#envelopeObject (readonly)

Returns the value of attribute envelope.



4
5
6
# File 'lib/rails-pipeline/handlers/base_handler.rb', line 4

def envelope
  @envelope
end

#event_typeObject (readonly)

Returns the value of attribute event_type.



4
5
6
# File 'lib/rails-pipeline/handlers/base_handler.rb', line 4

def event_type
  @event_type
end

#payloadObject (readonly)

Returns the value of attribute payload.



4
5
6
# File 'lib/rails-pipeline/handlers/base_handler.rb', line 4

def payload
  @payload
end

#target_classObject (readonly)

Returns the value of attribute target_class.



4
5
6
# File 'lib/rails-pipeline/handlers/base_handler.rb', line 4

def target_class
  @target_class
end