Class: Strait::Rule

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

Instance Method Summary collapse

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_hObject



15
16
17
# File 'lib/strait/rule.rb', line 15

def to_h
  @rule
end