Class: IceCube::Validations::Until::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/ice_cube/validations/until.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#timeObject (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

#typeObject



23
24
25
# File 'lib/ice_cube/validations/until.rb', line 23

def type
  :dealbreaker
end

#validate(t, schedule) ⇒ Object

Raises:



43
44
45
# File 'lib/ice_cube/validations/until.rb', line 43

def validate(t, schedule)
  raise UntilExceeded if t > time 
end