Class: SiteMaps::Notification::Event
- Inherits:
-
Object
- Object
- SiteMaps::Notification::Event
- Extended by:
- Forwardable
- Defined in:
- lib/site_maps/notification/event.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(id, payload = {}) ⇒ Event
constructor
private
Initialize a new event.
- #listener_method ⇒ Object private
-
#payload(data = nil) ⇒ Object
Get or set a payload.
Constructor Details
#initialize(id, payload = {}) ⇒ Event
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new event
21 22 23 24 |
# File 'lib/site_maps/notification/event.rb', line 21 def initialize(id, payload = {}) @id = id @payload = payload end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
11 12 13 |
# File 'lib/site_maps/notification/event.rb', line 11 def id @id end |
Instance Method Details
#listener_method ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/site_maps/notification/event.rb', line 45 def listener_method @listener_method ||= Primitive::String.new("on_#{id}").underscore.to_sym end |
# ⇒ Hash #payload(data) ⇒ Event
Get or set a payload
36 37 38 39 40 41 42 |
# File 'lib/site_maps/notification/event.rb', line 36 def payload(data = nil) if data self.class.new(id, @payload.merge(data)) else @payload end end |