Class: ActiveRecord::Journal::Journable::Rule

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/active_record/journal/journable/rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(journable, options) ⇒ Rule

Returns a new instance of Rule.



19
20
21
22
# File 'lib/active_record/journal/journable/rule.rb', line 19

def initialize(journable, options)
  @journable = journable
  @options = options
end

Instance Attribute Details

#journableObject (readonly)

Returns the value of attribute journable.



17
18
19
# File 'lib/active_record/journal/journable/rule.rb', line 17

def journable
  @journable
end

#optionsObject (readonly)

Returns the value of attribute options.



17
18
19
# File 'lib/active_record/journal/journable/rule.rb', line 17

def options
  @options
end

Instance Method Details

#conditions_met?(rec) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
# File 'lib/active_record/journal/journable/rule.rb', line 24

def conditions_met?(rec)
  return true unless self.if || self.unless

  assert_value = self.if ? true : false
  condition = self.if || self.unless
  assert_condition(condition, rec, assert_value)
end