Class: WithEvents::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/with_events/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, klass, options = {}) ⇒ Event

Options:

name - event name klass - resource class name options[:condition] - condition to check whether event can be triggered options[:callback] - callback to invoke on event options[:stream] - stream object event belongs to options[:identifier] - resource identifier (symbol, Proc or Class) options[:finder] - resource finder (symbol, Proc or Class) options[:subscribe] - subscribe to SQS queue



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/with_events/event.rb', line 19

def initialize(name, klass, options = {})
  @name = name
  @klass = klass
  @options = options
  @condition = options[:condition]
  @callback = options[:callback]
  @stream = options[:stream]
  @identifier = options[:identifier]
  @finder = options[:finder]

  define_condition
  define_callback
end

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



5
6
7
# File 'lib/with_events/event.rb', line 5

def callback
  @callback
end

#conditionObject (readonly)

Returns the value of attribute condition.



5
6
7
# File 'lib/with_events/event.rb', line 5

def condition
  @condition
end

#finderObject (readonly)

Returns the value of attribute finder.



5
6
7
# File 'lib/with_events/event.rb', line 5

def finder
  @finder
end

#identifierObject (readonly)

Returns the value of attribute identifier.



5
6
7
# File 'lib/with_events/event.rb', line 5

def identifier
  @identifier
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/with_events/event.rb', line 5

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/with_events/event.rb', line 5

def options
  @options
end

#streamObject (readonly)

Returns the value of attribute stream.



5
6
7
# File 'lib/with_events/event.rb', line 5

def stream
  @stream
end