Skip to content

Commit 58fdcd0

Browse files
committed
Cleanup method order: build_s before other builders
1 parent 98a10e1 commit 58fdcd0

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

lib/ice_cube/validations/day_of_month.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ def type
2828
:day
2929
end
3030

31+
def build_s(builder)
32+
builder.piece(:day_of_month) << StringBuilder.nice_number(day)
33+
end
34+
3135
StringBuilder.register_formatter(:day_of_month) do |entries|
3236
str = "on the #{StringBuilder.sentence(entries)} "
3337
str << (entries.size == 1 ? 'day of the month' : 'days of the month')
3438
str
3539
end
3640

37-
def build_s(builder)
38-
builder.piece(:day_of_month) << StringBuilder.nice_number(day)
39-
end
40-
4141
def build_hash(builder)
4242
builder.validations_array(:day_of_month) << day
4343
end

lib/ice_cube/validations/day_of_week.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ def validate(time, schedule)
4242
sum
4343
end
4444

45-
StringBuilder.register_formatter(:day_of_week) do |segments|
46-
'on the ' + segments.join(' and ')
47-
end
48-
4945
def build_s(builder)
5046
builder.piece(:day_of_week) << "#{StringBuilder.nice_number(occ)} #{Date::DAYNAMES[day]}"
5147
end
5248

49+
StringBuilder.register_formatter(:day_of_week) do |segments|
50+
'on the ' + segments.join(' and ')
51+
end
52+
5353
def build_ical(builder)
5454
ical_day = IcalBuilder.fixnum_to_ical_day(day)
5555
# Delete any with this day and no occ first

lib/ice_cube/validations/day_of_year.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ def validate(time, schedule)
3333
diff >= 0 ? diff : diff + days_in_year
3434
end
3535

36+
def build_s(builder)
37+
builder.piece(:day_of_year) << StringBuilder.nice_number(day)
38+
end
39+
3640
StringBuilder.register_formatter(:day_of_year) do |entries|
3741
str = "on the #{StringBuilder.sentence(entries)} "
3842
str << (entries.size == 1 ? 'day of the year' : 'days of the year')
3943
str
4044
end
4145

42-
def build_s(builder)
43-
builder.piece(:day_of_year) << StringBuilder.nice_number(day)
44-
end
45-
4646
def build_hash(builder)
4747
builder.validations_array(:day_of_year) << day
4848
end

0 commit comments

Comments
 (0)