Class: Fare::Topic
- Inherits:
-
Object
- Object
- Fare::Topic
- Defined in:
- lib/fare/topic.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #fetch(key) ⇒ Object
- #handles?(event) ⇒ Boolean
-
#initialize(options) ⇒ Topic
constructor
A new instance of Topic.
Constructor Details
#initialize(options) ⇒ Topic
Returns a new instance of Topic.
6 7 8 9 10 |
# File 'lib/fare/topic.rb', line 6 def initialize() @subject = .fetch(:subject) @action = .fetch(:action) @version = [:version] end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
4 5 6 |
# File 'lib/fare/topic.rb', line 4 def action @action end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
4 5 6 |
# File 'lib/fare/topic.rb', line 4 def subject @subject end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/fare/topic.rb', line 4 def version @version end |
Instance Method Details
#[](key) ⇒ Object
16 17 18 |
# File 'lib/fare/topic.rb', line 16 def [](key) public_send(key) end |
#fetch(key) ⇒ Object
20 21 22 |
# File 'lib/fare/topic.rb', line 20 def fetch(key) public_send(key) end |
#handles?(event) ⇒ Boolean
12 13 14 |
# File 'lib/fare/topic.rb', line 12 def handles?(event) subject.to_s == event.subject && action.to_s == event.action end |