Class: Mutual::Messaging::Task
- Inherits:
-
Object
- Object
- Mutual::Messaging::Task
- Defined in:
- lib/messaging/task_manager.rb
Instance Attribute Summary collapse
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
-
#return_address ⇒ Object
readonly
Returns the value of attribute return_address.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
Instance Method Summary collapse
-
#initialize(options) ⇒ Task
constructor
A new instance of Task.
- #marshal ⇒ Object
- #to_json(*args) ⇒ Object
Constructor Details
#initialize(options) ⇒ Task
Returns a new instance of Task.
27 28 29 30 31 32 33 |
# File 'lib/messaging/task_manager.rb', line 27 def initialize() properties = .values_at(:task_id, :type, :name, :body) raise ArgumentError unless properties.all? {|p| p != nil } @task_id, @type, @name, @body = properties @return_address = [:return_address] @queue = "tasks.#{@type}" end |
Instance Attribute Details
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
26 27 28 |
# File 'lib/messaging/task_manager.rb', line 26 def queue @queue end |
#return_address ⇒ Object (readonly)
Returns the value of attribute return_address.
26 27 28 |
# File 'lib/messaging/task_manager.rb', line 26 def return_address @return_address end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
26 27 28 |
# File 'lib/messaging/task_manager.rb', line 26 def task_id @task_id end |
Instance Method Details
#marshal ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/messaging/task_manager.rb', line 35 def marshal hash = { :task_id => @task_id, :name => @name, :body => @body } hash[:return_address] = @return_address if @return_address hash end |
#to_json(*args) ⇒ Object
45 46 47 |
# File 'lib/messaging/task_manager.rb', line 45 def to_json(*args) marshal.to_json(*args) end |