Class: Strait::DSL
- Inherits:
-
Object
- Object
- Strait::DSL
- Defined in:
- lib/strait/dsl.rb
Instance Attribute Summary collapse
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
Instance Method Summary collapse
-
#initialize(&block) ⇒ DSL
constructor
A new instance of DSL.
- #limit(count, per:, buckets: 60) ⇒ Object
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
#rules ⇒ Object (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 |