Class: Basquiat::Adapters::RabbitMq::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/basquiat/adapters/rabbitmq/events.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEvents

Returns a new instance of Events.



9
10
11
12
13
# File 'lib/basquiat/adapters/rabbitmq/events.rb', line 9

def initialize
  @keys     = []
  @exact    = {}
  @patterns = {}
end

Instance Attribute Details

#keysObject (readonly)

Returns the value of attribute keys.



7
8
9
# File 'lib/basquiat/adapters/rabbitmq/events.rb', line 7

def keys
  @keys
end

Instance Method Details

#[](key) ⇒ Object



24
25
26
27
28
# File 'lib/basquiat/adapters/rabbitmq/events.rb', line 24

def [](key)
  @exact.fetch(key) { simple_pattern_match(key) }
rescue KeyError
  raise KeyError, "No event handler found for #{key}"
end

#[]=(key, value) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/basquiat/adapters/rabbitmq/events.rb', line 15

def []=(key, value)
  if key =~ /\*|#/
    set_pattern_key(key, value)
  else
    @exact[key] = value
  end
  @keys.push key
end