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, start_time) ⇒ Object
Constructor Details
#initialize(time) ⇒ Validation
Returns a new instance of Validation.
19 20 21 |
# File 'lib/ice_cube/validations/until.rb', line 19 def initialize(time) @time = time end |
Instance Attribute Details
#time ⇒ Object (readonly)
Returns the value of attribute time.
17 18 19 |
# File 'lib/ice_cube/validations/until.rb', line 17 def time @time end |
Instance Method Details
#build_hash(builder) ⇒ Object
41 42 43 |
# File 'lib/ice_cube/validations/until.rb', line 41 def build_hash(builder) builder[:until] = TimeUtil.serialize_time(time) end |
#build_ical(builder) ⇒ Object
45 46 47 |
# File 'lib/ice_cube/validations/until.rb', line 45 def build_ical(builder) builder["UNTIL"] << IcalBuilder.ical_utc_format(time) end |
#build_s(builder) ⇒ Object
36 37 38 39 |
# File 'lib/ice_cube/validations/until.rb', line 36 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
27 28 29 |
# File 'lib/ice_cube/validations/until.rb', line 27 def dst_adjust? false end |
#type ⇒ Object
23 24 25 |
# File 'lib/ice_cube/validations/until.rb', line 23 def type :limit end |
#validate(step_time, start_time) ⇒ Object
31 32 33 34 |
# File 'lib/ice_cube/validations/until.rb', line 31 def validate(step_time, start_time) end_time = TimeUtil.ensure_time(time, start_time, true) raise UntilExceeded if step_time > end_time end |