Class: EventsEmitter::Base
- Inherits:
-
Object
- Object
- EventsEmitter::Base
- Defined in:
- lib/events_emitter/base.rb
Instance Method Summary collapse
- #event(key, value = 1) ⇒ Object
-
#initialize(type) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(type) ⇒ Base
Returns a new instance of Base.
3 4 5 6 7 |
# File 'lib/events_emitter/base.rb', line 3 def initialize(type) @backend = constantize("EventsEmitter::#{type.to_s.capitalize}").new rescue NameError => e raise ArgumentError.new("Unsupported emitter: #{type}") end |
Instance Method Details
#event(key, value = 1) ⇒ Object
9 10 11 |
# File 'lib/events_emitter/base.rb', line 9 def event(key, value = 1) @backend.record(key, value) end |