Class: Orchestrate::EventSource
- Inherits:
-
Object
- Object
- Orchestrate::EventSource
- Defined in:
- lib/orchestrate/event_source.rb
Overview
Manages Event Types for a KeyValue item.
Instance Attribute Summary collapse
-
#kv_item ⇒ Orchestrate::KeyValue
readonly
The KeyValue to which the sourced events belong.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
(also: #eql?)
Equivalent to
String#==
. -
#[](event_type) ⇒ EventType
Accessor for event types.
-
#initialize(kv_item) ⇒ EventSource
constructor
Instantiages a new EventSource manager.
-
#to_s ⇒ Object
Pretty-Printed string representation.
Constructor Details
#initialize(kv_item) ⇒ EventSource
Instantiages a new EventSource manager.
11 12 13 14 |
# File 'lib/orchestrate/event_source.rb', line 11 def initialize(kv_item) @kv_item = kv_item @types = {} end |
Instance Attribute Details
#kv_item ⇒ Orchestrate::KeyValue (readonly)
Returns The KeyValue to which the sourced events belong.
7 8 9 |
# File 'lib/orchestrate/event_source.rb', line 7 def kv_item @kv_item end |
Instance Method Details
#==(other) ⇒ true, false Also known as: eql?
Equivalent to String#==
. Compares by kv_item.
26 27 28 |
# File 'lib/orchestrate/event_source.rb', line 26 def ==(other) other.kind_of?(Orchestrate::EventSource) && other.kv_item == kv_item end |
#[](event_type) ⇒ EventType
Accessor for event types.
19 20 21 |
# File 'lib/orchestrate/event_source.rb', line 19 def [](event_type) @types[event_type.to_s] ||= EventType.new(@kv_item, event_type) end |
#to_s ⇒ Object
Returns Pretty-Printed string representation.
32 33 34 |
# File 'lib/orchestrate/event_source.rb', line 32 def to_s "#<Orchestrate::EventSource key_value=#{kv_item}>" end |