Class: Triggerable::Rules::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/triggerable/rules/rule.rb

Direct Known Subclasses

Automation, Trigger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, options, block) ⇒ Rule

Returns a new instance of Rule.



6
7
8
9
10
11
# File 'lib/triggerable/rules/rule.rb', line 6

def initialize model, options, block
  @model     = model
  @condition = Conditions::Condition.build(options[:if])
  @name      = options[:name]
  @actions   = Triggerable::Actions::Action.build(block || options[:do])
end

Instance Attribute Details

#actionsObject

Returns the value of attribute actions.



4
5
6
# File 'lib/triggerable/rules/rule.rb', line 4

def actions
  @actions
end

#conditionObject

Returns the value of attribute condition.



4
5
6
# File 'lib/triggerable/rules/rule.rb', line 4

def condition
  @condition
end

#modelObject

Returns the value of attribute model.



4
5
6
# File 'lib/triggerable/rules/rule.rb', line 4

def model
  @model
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/triggerable/rules/rule.rb', line 4

def name
  @name
end