Class: IceCube::Validations::Count::Validation
- Inherits:
-
Object
- Object
- IceCube::Validations::Count::Validation
- Defined in:
- lib/ice_cube/validations/count.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#rule ⇒ Object
readonly
Returns the value of attribute rule.
Instance Method Summary collapse
- #build_hash(builder) ⇒ Object
- #build_ical(builder) ⇒ Object
- #build_s(builder) ⇒ Object
- #dst_adjust? ⇒ Boolean
-
#initialize(count, rule) ⇒ Validation
constructor
A new instance of Validation.
- #type ⇒ Object
- #validate(time, start_time) ⇒ Object
Constructor Details
#initialize(count, rule) ⇒ Validation
Returns a new instance of Validation.
22 23 24 25 |
# File 'lib/ice_cube/validations/count.rb', line 22 def initialize(count, rule) @count = count @rule = rule end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
20 21 22 |
# File 'lib/ice_cube/validations/count.rb', line 20 def count @count end |
#rule ⇒ Object (readonly)
Returns the value of attribute rule.
20 21 22 |
# File 'lib/ice_cube/validations/count.rb', line 20 def rule @rule end |
Instance Method Details
#build_hash(builder) ⇒ Object
43 44 45 |
# File 'lib/ice_cube/validations/count.rb', line 43 def build_hash(builder) builder[:count] = count end |
#build_ical(builder) ⇒ Object
47 48 49 |
# File 'lib/ice_cube/validations/count.rb', line 47 def build_ical(builder) builder['COUNT'] << count end |
#build_s(builder) ⇒ Object
39 40 41 |
# File 'lib/ice_cube/validations/count.rb', line 39 def build_s(builder) builder.piece(:count) << count end |
#dst_adjust? ⇒ Boolean
31 32 33 |
# File 'lib/ice_cube/validations/count.rb', line 31 def dst_adjust? false end |
#type ⇒ Object
27 28 29 |
# File 'lib/ice_cube/validations/count.rb', line 27 def type :limit end |
#validate(time, start_time) ⇒ Object
35 36 37 |
# File 'lib/ice_cube/validations/count.rb', line 35 def validate(time, start_time) raise CountExceeded if rule.uses && rule.uses >= count end |