Class: Basquiat::Adapters::RabbitMq::Events
- Inherits:
-
Object
- Object
- Basquiat::Adapters::RabbitMq::Events
- Defined in:
- lib/basquiat/adapters/rabbitmq/events.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize ⇒ Events
constructor
A new instance of Events.
Constructor Details
#initialize ⇒ Events
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
#keys ⇒ Object (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 |