Class: Orchestrate::EventSource

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestrate/event_source.rb

Overview

Manages Event Types for a KeyValue item.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kv_item) ⇒ EventSource

Instantiages a new EventSource manager.

Parameters:


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_itemOrchestrate::KeyValue (readonly)

Returns The KeyValue to which the sourced events belong.

Returns:


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.

Parameters:

Returns:

  • (true, false)

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.

Parameters:

  • event_type (#to_s)

    The type key for the events.

Returns:


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_sObject

Returns Pretty-Printed string representation.

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