Class: Alephant::Publisher::PublishTask

Inherits:
Object
  • Object
show all
Includes:
Callable
Defined in:
lib/alephant/publisher/publish_task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, message) ⇒ PublishTask

Returns a new instance of PublishTask.



14
15
16
17
# File 'lib/alephant/publisher/publish_task.rb', line 14

def initialize(opts, message)
  @message = message
  @opts = opts
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



12
13
14
# File 'lib/alephant/publisher/publish_task.rb', line 12

def message
  @message
end

#optsObject (readonly)

Returns the value of attribute opts.



12
13
14
# File 'lib/alephant/publisher/publish_task.rb', line 12

def opts
  @opts
end

Instance Method Details

#callObject



19
20
21
22
23
24
# File 'lib/alephant/publisher/publish_task.rb', line 19

def call
  unless message.nil?
    Writer.new(opts).write(message)
    message.delete
  end
end