class IceCube::Validations::DayOfYear::Validation
Attributes
day[R]
Public Class Methods
new(day)
click to toggle source
# File lib/ice_cube/validations/day_of_year.rb, line 20 def initialize(day) @day = day end
Public Instance Methods
build_hash(builder)
click to toggle source
# File lib/ice_cube/validations/day_of_year.rb, line 43 def build_hash(builder) builder.validations_array(:day_of_year) << day end
build_ical(builder)
click to toggle source
# File lib/ice_cube/validations/day_of_year.rb, line 47 def build_ical(builder) builder['BYYEARDAY'] << day end
build_s(builder)
click to toggle source
# File lib/ice_cube/validations/day_of_year.rb, line 39 def build_s(builder) builder.piece(:day_of_year) << StringBuilder.nice_number(day) end
dst_adjust?()
click to toggle source
# File lib/ice_cube/validations/day_of_year.rb, line 28 def dst_adjust? true end
type()
click to toggle source
# File lib/ice_cube/validations/day_of_year.rb, line 24 def type :day end
validate(step_time, start_time)
click to toggle source
# File lib/ice_cube/validations/day_of_year.rb, line 32 def validate(step_time, start_time) days_in_year = TimeUtil.days_in_year(step_time) yday = day < 0 ? day + days_in_year + 1 : day offset = yday - step_time.yday offset >= 0 ? offset : offset + days_in_year end