Class: Strait::Rule
- Inherits:
-
Object
- Object
- Strait::Rule
- Defined in:
- lib/strait/rule.rb
Instance Method Summary collapse
- #call(user) ⇒ Object
-
#initialize(name:, rule:, config:) ⇒ Rule
constructor
A new instance of Rule.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, rule:, config:) ⇒ Rule
Returns a new instance of Rule.
5 6 7 8 9 |
# File 'lib/strait/rule.rb', line 5 def initialize(name:, rule:, config:) @name = name @rule = rule @config = config end |
Instance Method Details
#call(user) ⇒ Object
11 12 13 |
# File 'lib/strait/rule.rb', line 11 def call(user) period_count_for(user) <= @rule[:count] end |
#to_h ⇒ Object
15 16 17 |
# File 'lib/strait/rule.rb', line 15 def to_h @rule end |