Class: Moku6::Rules::RetentionRule

Inherits:
BaseRule
  • Object
show all
Defined in:
lib/moku6/rules/retention_rule.rb

Instance Method Summary collapse

Methods inherited from BaseRule

#initialize

Constructor Details

This class inherits a constructor from Moku6::Rules::BaseRule

Instance Method Details

#check(event) ⇒ Object

: (Event event) -> Array



8
9
10
11
12
13
14
15
16
# File 'lib/moku6/rules/retention_rule.rb', line 8

def check(event)
  retention = event.retention
  years = retention.is_a?(Hash) ? retention["years"] : nil
  return [] if years.is_a?(Integer) && years >= 1

  [offense(event, :error,
    "retention.years must be a positive integer.",
    rule: "retention_present")]
end