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
- #dst_adjust? ⇒ Boolean
-
#initialize(time) ⇒ Validation
constructor
A new instance of Validation.
- #type ⇒ Object
- #validate(step_time, schedule) ⇒ Object
Constructor Details
#initialize(time) ⇒ Validation
Returns a new instance of Validation.
24 25 26 |
# File 'lib/ice_cube/validations/until.rb', line 24 def initialize(time) @time = time end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
22 23 24 |
# File 'lib/ice_cube/validations/until.rb', line 22 def time @time end |
Instance Method Details
#build_hash(builder) ⇒ Object
45 46 47 |
# File 'lib/ice_cube/validations/until.rb', line 45 def build_hash(builder) builder[:until] = TimeUtil.serialize_time(time) end |
#build_ical(builder) ⇒ Object
49 50 51 |
# File 'lib/ice_cube/validations/until.rb', line 49 def build_ical(builder) builder['UNTIL'] << IcalBuilder.ical_utc_format(time) end |
#build_s(builder) ⇒ Object
40 41 42 43 |
# File 'lib/ice_cube/validations/until.rb', line 40 def build_s(builder) date = IceCube::I18n.l(time, format: IceCube.to_s_time_format) builder.piece(:until) << IceCube::I18n.t('ice_cube.until', date: date) end |
#dst_adjust? ⇒ Boolean
32 33 34 |
# File 'lib/ice_cube/validations/until.rb', line 32 def dst_adjust? false end |
#type ⇒ Object
28 29 30 |
# File 'lib/ice_cube/validations/until.rb', line 28 def type :limit end |
#validate(step_time, schedule) ⇒ Object
36 37 38 |
# File 'lib/ice_cube/validations/until.rb', line 36 def validate(step_time, schedule) raise UntilExceeded if step_time > time end |