Class: Strait::DSL

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ DSL

Returns a new instance of DSL.



7
8
9
10
# File 'lib/strait/dsl.rb', line 7

def initialize(&block)
  @rules = []
  instance_eval(&block)
end

Instance Attribute Details

#rulesObject (readonly)

Returns the value of attribute rules.



5
6
7
# File 'lib/strait/dsl.rb', line 5

def rules
  @rules
end

Instance Method Details

#limit(count, per:, buckets: 60) ⇒ Object



12
13
14
# File 'lib/strait/dsl.rb', line 12

def limit(count, per:, buckets: 60)
  @rules << { count: count, period: per, buckets: buckets }
end