Module: HairTrigger::Base

Defined in:
lib/hair_trigger/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#triggersObject (readonly)

Returns the value of attribute triggers.



3
4
5
# File 'lib/hair_trigger/base.rb', line 3

def triggers
  @triggers
end

Instance Method Details

#trigger(name = nil, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/hair_trigger/base.rb', line 5

def trigger(name = nil, options = {})
  if name.is_a?(Hash)
    options = name
    name = nil
  end
  options[:compatibility] ||= ::HairTrigger::Builder::compatibility
  options[:generated] = true
  @triggers ||= []
  trigger = ::HairTrigger::Builder.new(name, options)
  @triggers << trigger
  trigger.on(table_name)
end