Class: IceCube::Validations::Until::Validation
- Inherits:
-
Object
- Object
- IceCube::Validations::Until::Validation
- Defined in:
- lib/ice_cube/validations/until.rb
Instance Attribute Summary collapse
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #build_hash(builder) ⇒ Object
- #build_ical(builder) ⇒ Object
- #build_s(builder) ⇒ Object
-
#initialize(time) ⇒ Validation
constructor
A new instance of Validation.
- #type ⇒ Object
- #validate(t, schedule) ⇒ Object
Constructor Details
#initialize(time) ⇒ Validation
Returns a new instance of Validation.
27 28 29 |
# File 'lib/ice_cube/validations/until.rb', line 27 def initialize(time) @time = time end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
21 22 23 |
# File 'lib/ice_cube/validations/until.rb', line 21 def time @time end |
Instance Method Details
#build_hash(builder) ⇒ Object
35 36 37 |
# File 'lib/ice_cube/validations/until.rb', line 35 def build_hash(builder) builder[:until] = TimeUtil.serialize_time(time) end |
#build_ical(builder) ⇒ Object
31 32 33 |
# File 'lib/ice_cube/validations/until.rb', line 31 def build_ical(builder) builder['UNTIL'] << IcalBuilder.ical_utc_format(time) end |
#build_s(builder) ⇒ Object
39 40 41 |
# File 'lib/ice_cube/validations/until.rb', line 39 def build_s(builder) builder.piece(:until) << "until #{time.strftime(TO_S_TIME_FORMAT)}" end |
#type ⇒ Object
23 24 25 |
# File 'lib/ice_cube/validations/until.rb', line 23 def type :dealbreaker end |
#validate(t, schedule) ⇒ Object
43 44 45 |
# File 'lib/ice_cube/validations/until.rb', line 43 def validate(t, schedule) raise UntilExceeded if t > time end |