Class: Travis::Notifications::Worker::Payload
- Inherits:
-
Object
- Object
- Travis::Notifications::Worker::Payload
- Defined in:
- lib/travis/notifications/worker/payload.rb
Instance Attribute Summary collapse
-
#extra ⇒ Object
readonly
Returns the value of attribute extra.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
Instance Method Summary collapse
- #base_dir ⇒ Object
- #data ⇒ Object
-
#initialize(job, extra = {}) ⇒ Payload
constructor
A new instance of Payload.
- #render(format) ⇒ Object
- #template ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(job, extra = {}) ⇒ Payload
Returns a new instance of Payload.
7 8 9 |
# File 'lib/travis/notifications/worker/payload.rb', line 7 def initialize(job, extra = {}) @job, @extra = job, extra end |
Instance Attribute Details
#extra ⇒ Object (readonly)
Returns the value of attribute extra.
5 6 7 |
# File 'lib/travis/notifications/worker/payload.rb', line 5 def extra @extra end |
#job ⇒ Object (readonly)
Returns the value of attribute job.
5 6 7 |
# File 'lib/travis/notifications/worker/payload.rb', line 5 def job @job end |
Instance Method Details
#base_dir ⇒ Object
27 28 29 |
# File 'lib/travis/notifications/worker/payload.rb', line 27 def base_dir File.('../views', __FILE__) end |
#data ⇒ Object
19 20 21 |
# File 'lib/travis/notifications/worker/payload.rb', line 19 def data { :job => job, :repository => job.repository } end |
#render(format) ⇒ Object
15 16 17 |
# File 'lib/travis/notifications/worker/payload.rb', line 15 def render(format) Travis::Renderer.send(format, data, :type => 'worker', :template => template, :base_dir => base_dir).deep_merge(extra) end |
#template ⇒ Object
23 24 25 |
# File 'lib/travis/notifications/worker/payload.rb', line 23 def template job.class.name.underscore end |
#to_hash ⇒ Object
11 12 13 |
# File 'lib/travis/notifications/worker/payload.rb', line 11 def to_hash render(:hash) end |