ice_cube 0.16.3 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. data/config/locales/de.yml +1 -1
  3. data/config/locales/fr.yml +2 -2
  4. data/config/locales/id.yml +134 -0
  5. data/config/locales/it.yml +179 -0
  6. data/config/locales/nl.yml +133 -0
  7. data/config/locales/sv.yml +1 -1
  8. data/lib/ice_cube/builders/hash_builder.rb +1 -5
  9. data/lib/ice_cube/builders/ical_builder.rb +13 -15
  10. data/lib/ice_cube/builders/string_builder.rb +10 -16
  11. data/lib/ice_cube/deprecated.rb +3 -4
  12. data/lib/ice_cube/errors/count_exceeded.rb +0 -2
  13. data/lib/ice_cube/errors/until_exceeded.rb +0 -2
  14. data/lib/ice_cube/flexible_hash.rb +3 -7
  15. data/lib/ice_cube/i18n.rb +11 -23
  16. data/lib/ice_cube/input_alignment.rb +9 -11
  17. data/lib/ice_cube/null_i18n.rb +6 -6
  18. data/lib/ice_cube/occurrence.rb +10 -11
  19. data/lib/ice_cube/parsers/hash_parser.rb +3 -6
  20. data/lib/ice_cube/parsers/ical_parser.rb +39 -38
  21. data/lib/ice_cube/parsers/yaml_parser.rb +2 -4
  22. data/lib/ice_cube/rule.rb +7 -18
  23. data/lib/ice_cube/rules/daily_rule.rb +0 -4
  24. data/lib/ice_cube/rules/hourly_rule.rb +0 -4
  25. data/lib/ice_cube/rules/minutely_rule.rb +0 -4
  26. data/lib/ice_cube/rules/monthly_rule.rb +0 -4
  27. data/lib/ice_cube/rules/secondly_rule.rb +0 -4
  28. data/lib/ice_cube/rules/weekly_rule.rb +1 -5
  29. data/lib/ice_cube/rules/yearly_rule.rb +0 -4
  30. data/lib/ice_cube/schedule.rb +32 -40
  31. data/lib/ice_cube/single_occurrence_rule.rb +1 -5
  32. data/lib/ice_cube/time_util.rb +49 -57
  33. data/lib/ice_cube/validated_rule.rb +4 -10
  34. data/lib/ice_cube/validations/count.rb +2 -8
  35. data/lib/ice_cube/validations/daily_interval.rb +5 -11
  36. data/lib/ice_cube/validations/day.rb +7 -13
  37. data/lib/ice_cube/validations/day_of_month.rb +4 -10
  38. data/lib/ice_cube/validations/day_of_week.rb +10 -13
  39. data/lib/ice_cube/validations/day_of_year.rb +6 -12
  40. data/lib/ice_cube/validations/fixed_value.rb +9 -15
  41. data/lib/ice_cube/validations/hour_of_day.rb +6 -12
  42. data/lib/ice_cube/validations/hourly_interval.rb +3 -9
  43. data/lib/ice_cube/validations/lock.rb +8 -14
  44. data/lib/ice_cube/validations/minute_of_hour.rb +4 -10
  45. data/lib/ice_cube/validations/minutely_interval.rb +4 -10
  46. data/lib/ice_cube/validations/month_of_year.rb +2 -8
  47. data/lib/ice_cube/validations/monthly_interval.rb +4 -10
  48. data/lib/ice_cube/validations/schedule_lock.rb +0 -6
  49. data/lib/ice_cube/validations/second_of_minute.rb +4 -10
  50. data/lib/ice_cube/validations/secondly_interval.rb +2 -8
  51. data/lib/ice_cube/validations/until.rb +2 -8
  52. data/lib/ice_cube/validations/weekly_interval.rb +5 -11
  53. data/lib/ice_cube/validations/yearly_interval.rb +3 -9
  54. data/lib/ice_cube/version.rb +1 -3
  55. data/lib/ice_cube.rb +51 -51
  56. metadata +28 -12
  57. data/spec/spec_helper.rb +0 -79
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: afc29d6bebdb8a25e7926863560b6b73214887d7
4
- data.tar.gz: 850cad27d4f06dd30052222e4c30f6fa8b3b50e5
2
+ SHA256:
3
+ metadata.gz: 114901036ec2c7e42928b961eddcf9f958f9a5f7ea4de4aadcf57e2f33220339
4
+ data.tar.gz: '093d42679272a92e0958662949822cf544f24e8fba39dfaa7c1361fa8da1e738'
5
5
  SHA512:
6
- metadata.gz: 351c83281b34657ff2a64c8fc03e023265803ba8776d6f6a98c90fbbf04f14c0e0c9a7d7ee40f5a8c739cea31283b60c429b37521f7fe4e7ea61bc2175123c46
7
- data.tar.gz: d02fba63d82b7a26077cadf400a0bd45172d6d047c26533164f786654b925e0b6e28902cefec8ada0a2df10f08596237c848271ffbb85094323ec515a71f2431
6
+ metadata.gz: 8cb959423e6a8d7ae6959b7f2a3fcc38c36e24aed7087037ece993a49fd215d90836c6d3f4ea683b42dc05094e79a5b66632dc8c4bc955a922bb8063dca1616e
7
+ data.tar.gz: '0238da4a9c76cfbe63be01a61fbac7515bfd0a9bed34ff7fc3932fca0ad3b5a34222c38735baf343712abbc324542a64f7dbebaf76460e82faa970bb92713c15'
@@ -141,7 +141,7 @@ de:
141
141
  day_names:
142
142
  - Sonntag
143
143
  - Montag
144
- - Dinstag
144
+ - Dienstag
145
145
  - Mittwoch
146
146
  - Donnerstag
147
147
  - Freitag
@@ -137,7 +137,7 @@ fr:
137
137
  - dimanche
138
138
  - lundi
139
139
  - mardi
140
- - mecredi
140
+ - mercredi
141
141
  - jeudi
142
142
  - vendredi
143
143
  - samedi
@@ -170,4 +170,4 @@ fr:
170
170
  default: "%a, %d %b %Y %H:%M:%S %z"
171
171
  long: "%d %B %Y %H:%M"
172
172
  short: "%d %b %H:%M"
173
- pm: pm
173
+ pm: pm
@@ -0,0 +1,134 @@
1
+ id:
2
+ ice_cube:
3
+ pieces_connector: ' / '
4
+ not: 'kecuali %{target}'
5
+ not_on: 'kecuali %{target}'
6
+ date:
7
+ formats:
8
+ default: '%e %B %Y'
9
+ times:
10
+ other: '%{count} kali'
11
+ one: '%{count} kali'
12
+ until: 'sampai %{date}'
13
+ days_of_week: '%{segments} %{day}'
14
+ days_of_month:
15
+ other: 'hari ke %{segments} dalam satu bulan'
16
+ one: 'hari ke %{segments} dalam satu bulan'
17
+ days_of_year:
18
+ other: 'hari ke %{segments} dalam satu tahun'
19
+ one: 'hari ke %{segments} dalam satu tahun'
20
+ at_hours_of_the_day:
21
+ other: pada jam %{segments} dalam satu hari
22
+ one: pada jam %{segments} dalam satu hari
23
+ on_minutes_of_hour:
24
+ other: pada menit ke %{segments} dalam satu jam
25
+ one: pada menit ke %{segments} dalam satu jam
26
+ at_seconds_of_minute:
27
+ other: pada %{segments} detik
28
+ one: pada %{segments} detik
29
+ on_seconds_of_minute:
30
+ other: pada detik ke %{segments} dalam satu menit
31
+ one: pada detik ke %{segments} dalam satu menit
32
+ each_second:
33
+ one: Setiap detik
34
+ other: Setiap %{count} detik
35
+ each_minute:
36
+ one: Setiap menit
37
+ other: Setiap %{count} menit
38
+ each_hour:
39
+ one: Setiap jam
40
+ other: Setiap %{count} jam
41
+ each_day:
42
+ one: Setiap hari
43
+ other: Setiap %{count} hari
44
+ each_week:
45
+ one: Setiap minggu
46
+ other: Setiap %{count} minggu
47
+ each_month:
48
+ one: Setiap bulan
49
+ other: Setiap %{count} bulan
50
+ each_year:
51
+ one: Setiap tahun
52
+ other: Setiap %{count} tahun
53
+ 'on': pada %{sentence}
54
+ in: 'pada %{target}'
55
+ integer:
56
+ negative: '%{ordinal} sampai akhir'
57
+ literal_ordinals:
58
+ 1: pertama
59
+ -1: terakhir
60
+ -2: kedua sampai terakhir
61
+ ordinal: '%{number}%{ordinal}'
62
+ ordinals:
63
+ default:
64
+ on_weekends: pada akhir pekan
65
+ on_weekdays: pada hari kerja
66
+ days_on:
67
+ - Hari minggu
68
+ - Hari senin
69
+ - Hari selasa
70
+ - Hari rabu
71
+ - Hari kamis
72
+ - Hari jumat
73
+ - Hari sabtu
74
+ on_days: pada %{days}
75
+ array:
76
+ last_word_connector: ' dan '
77
+ two_words_connector: ' dan '
78
+ words_connector: ', '
79
+ string:
80
+ format:
81
+ day: '%{rest} %{current}'
82
+ day_of_week: '%{rest} %{current}'
83
+ day_of_month: '%{rest} %{current}'
84
+ day_of_year: '%{rest} %{current}'
85
+ hour_of_day: '%{rest} %{current}'
86
+ minute_of_hour: '%{rest} %{current}'
87
+ until: '%{rest} %{current}'
88
+ count: '%{rest} %{current}'
89
+ default: '%{rest} %{current}'
90
+ date:
91
+ abbr_day_names:
92
+ - Min
93
+ - Sen
94
+ - Sel
95
+ - Rab
96
+ - Kam
97
+ - Jum
98
+ - Sab
99
+ abbr_month_names:
100
+ -
101
+ - Jan
102
+ - Feb
103
+ - Mar
104
+ - Apr
105
+ - Mei
106
+ - Jun
107
+ - Jul
108
+ - Agu
109
+ - Sep
110
+ - Okt
111
+ - Nov
112
+ - Des
113
+ day_names:
114
+ - Minggu
115
+ - Senin
116
+ - Selasa
117
+ - Rabu
118
+ - Kamis
119
+ - Jumat
120
+ - Sabtu
121
+ month_names:
122
+ -
123
+ - Januari
124
+ - Februari
125
+ - Maret
126
+ - April
127
+ - Mei
128
+ - Juni
129
+ - Juli
130
+ - Agustus
131
+ - September
132
+ - Oktober
133
+ - November
134
+ - Desember
@@ -0,0 +1,179 @@
1
+ it:
2
+ ice_cube:
3
+ pieces_connector: ' / '
4
+ not: 'tranne %{target}'
5
+ not_on: 'tranne %{target}'
6
+ date:
7
+ formats:
8
+ default: '%-d. %B %Y'
9
+ month_names:
10
+ -
11
+ - gennaio
12
+ - febbraio
13
+ - marzo
14
+ - aprile
15
+ - maggio
16
+ - giugno
17
+ - luglio
18
+ - agosto
19
+ - settembre
20
+ - ottobre
21
+ - novembre
22
+ - dicembre
23
+ day_names:
24
+ - domenica
25
+ - lunedì
26
+ - martedì
27
+ - mercoledì
28
+ - giovedì
29
+ - venerdì
30
+ - sabato
31
+ times:
32
+ other: '%{count} volte'
33
+ one: '%{count} volta'
34
+ until: 'fino al %{date}'
35
+ days_of_week: '%{segments} %{day}'
36
+ days_of_month:
37
+ one: '%{segments} giorno del mese'
38
+ other: '%{segments} giorni del mese'
39
+ days_of_year:
40
+ one: "%{segments} giorno dell'anno"
41
+ other: "%{segments} giorni dell'anno"
42
+ at_hours_of_the_day:
43
+ one: alla %{segments} ora del giorno
44
+ other: alla %{segments} ora del giorno
45
+ on_minutes_of_hour:
46
+ one: al %{segments} minuto dell'ora
47
+ other: al %{segments} minuto dell'ora
48
+ at_seconds_of_minute:
49
+ one: al %{segments} secondo
50
+ other: al %{segments} secondo
51
+ on_seconds_of_minute:
52
+ one: al %{segments} secondo del minuto
53
+ other: al %{segments} secondo del minuto
54
+ each_second:
55
+ one: ogni secondo
56
+ other: Ogni %{count} secondi
57
+ each_minute:
58
+ one: Ogni minuto
59
+ other: Ogni %{count} minuti
60
+ each_hour:
61
+ one: Ogni ora
62
+ other: Ogni %{count} ore
63
+ each_day:
64
+ one: Ogni giorno
65
+ other: Ogni %{count} giorni
66
+ each_week:
67
+ one: Ogni settimana
68
+ other: Ogni %{count} settimane
69
+ each_month:
70
+ one: Ogni mese
71
+ other: Ogni %{count} mesi
72
+ each_year:
73
+ one: Ogni anno
74
+ other: Ogni %{count} anni
75
+ 'on': il %{sentence}
76
+ in: 'a %{target}'
77
+ integer:
78
+ negative: '%{ordinal}. e ultimo'
79
+ literal_ordinals:
80
+ -1: ultimo
81
+ -2: penultimo
82
+ ordinal: '%{number}%{ordinal}'
83
+ ordinals:
84
+ default: '.'
85
+ # 1: st
86
+ # 2: nd
87
+ # 3: rd
88
+ # 11: th
89
+ # 12: th
90
+ # 13: th
91
+ on_weekends: nel fine settimana
92
+ on_weekdays: nei giorni feriali
93
+ days_on:
94
+ - di domenica
95
+ - di lunedì
96
+ - di martedì
97
+ - di mercoledì
98
+ - di giovedì
99
+ - di venerdì
100
+ - di sabato
101
+ on_days: '%{days}'
102
+ array:
103
+ last_word_connector: ' e '
104
+ two_words_connector: ' e '
105
+ words_connector: ', '
106
+ string:
107
+ format:
108
+ day: '%{rest} %{current}'
109
+ day_of_week: '%{rest} %{current}'
110
+ day_of_month: '%{rest} %{current}'
111
+ day_of_year: '%{rest} %{current}'
112
+ hour_of_day: '%{rest} %{current}'
113
+ minute_of_hour: '%{rest} %{current}'
114
+ until: '%{rest} %{current}'
115
+ count: '%{rest} %{current}'
116
+ default: '%{rest} %{current}'
117
+
118
+ date:
119
+ abbr_day_names:
120
+ - dom
121
+ - lun
122
+ - mar
123
+ - mer
124
+ - gio
125
+ - ven
126
+ - sab
127
+ abbr_month_names:
128
+ -
129
+ - gen
130
+ - feb
131
+ - mar
132
+ - apr
133
+ - mag
134
+ - giu
135
+ - lug
136
+ - ago
137
+ - set
138
+ - ott
139
+ - nov
140
+ - dic
141
+ day_names:
142
+ - domenica
143
+ - lunedì
144
+ - martedì
145
+ - mercoledì
146
+ - giovedì
147
+ - venerdì
148
+ - sabato
149
+ formats:
150
+ default: "%d/%m/%Y"
151
+ long: "%d %B %Y"
152
+ short: "%d %b"
153
+ month_names:
154
+ -
155
+ - gennaio
156
+ - febbraio
157
+ - marzo
158
+ - aprile
159
+ - maggio
160
+ - giugno
161
+ - luglio
162
+ - agosto
163
+ - settembre
164
+ - ottobre
165
+ - novembre
166
+ - dicembre
167
+ order:
168
+ - :day
169
+ - :month
170
+ - :year
171
+
172
+ time:
173
+ am: alle
174
+ formats:
175
+ default: "%a, %d %b %Y %H:%M:%S %z"
176
+ long: "%B %d, %Y %H:%M"
177
+ short: "%d %b %H:%M"
178
+ pm: pm
179
+
@@ -0,0 +1,133 @@
1
+ nl:
2
+ ice_cube:
3
+ pieces_connector: ' / '
4
+ not: 'niet %{target}'
5
+ not_on: 'niet op %{target}'
6
+ date:
7
+ formats:
8
+ default: '%-d %B %Y'
9
+ times:
10
+ other: '%{count} keer'
11
+ one: '%{count} keer'
12
+ until: 'tot %{date}'
13
+ days_of_week: '%{segments} %{day}'
14
+ days_of_month:
15
+ other: '%{segments} dagen van de maand'
16
+ one: '%{segments} dag van de maand'
17
+ days_of_year:
18
+ other: '%{segments} dagen van het jaar'
19
+ one: '%{segments} dag van het jaar'
20
+ at_hours_of_the_day:
21
+ other: op de %{segments} uren van de dag
22
+ one: op het %{segments} uur
23
+ on_minutes_of_hour:
24
+ other: op de %{segments} minuten van het uur
25
+ one: om de %{segments} minuut van het uur
26
+ at_seconds_of_minute:
27
+ other: op de %{segments} seconden
28
+ one: op de %{segments} seconde
29
+ on_seconds_of_minute:
30
+ other: op de %{segments} seconden van de minuut
31
+ one: op de %{segments} seconde van de minuut
32
+ each_second:
33
+ one: Elke seconde
34
+ other: Elke %{count} seconden
35
+ each_minute:
36
+ one: Elke minuut
37
+ other: Elke %{count} minuten
38
+ each_hour:
39
+ one: Elk uur
40
+ other: Elke %{count} uren
41
+ each_day:
42
+ one: Dagelijks
43
+ other: Elke %{count} dagen
44
+ each_week:
45
+ one: Wekelijks
46
+ other: Elke %{count} weken
47
+ each_month:
48
+ one: Maandelijks
49
+ other: Elke %{count} maanden
50
+ each_year:
51
+ one: Jaarlijks
52
+ other: Elke %{count} jaren
53
+ 'on': op de %{sentence}
54
+ in: 'in %{target}'
55
+ integer:
56
+ negative: '%{ordinal} laatste'
57
+ literal_ordinals:
58
+ -1: laatste
59
+ -2: voorlaatste
60
+ ordinal: '%{number}%{ordinal}'
61
+ ordinals:
62
+ default: e
63
+ on_weekends: in het weekend
64
+ on_weekdays: op weekdagen
65
+ days_on:
66
+ - zondagen
67
+ - maandagen
68
+ - dinsdagen
69
+ - woensdagen
70
+ - donderdagen
71
+ - vrijdagen
72
+ - zaterdagen
73
+ on_days: op %{days}
74
+ array:
75
+ last_word_connector: ' en '
76
+ two_words_connector: ' en '
77
+ words_connector: ', '
78
+ string:
79
+ format:
80
+ day: '%{rest} %{current}'
81
+ day_of_week: '%{rest} %{current}'
82
+ day_of_month: '%{rest} %{current}'
83
+ day_of_year: '%{rest} %{current}'
84
+ hour_of_day: '%{rest} %{current}'
85
+ minute_of_hour: '%{rest} %{current}'
86
+ until: '%{rest} %{current}'
87
+ count: '%{rest} %{current}'
88
+ default: '%{rest} %{current}'
89
+ date:
90
+ abbr_day_names:
91
+ - zo
92
+ - ma
93
+ - di
94
+ - wo
95
+ - do
96
+ - vr
97
+ - za
98
+ abbr_month_names:
99
+ -
100
+ - jan
101
+ - feb
102
+ - mrt
103
+ - apr
104
+ - mei
105
+ - jun
106
+ - jul
107
+ - aug
108
+ - sep
109
+ - okt
110
+ - nov
111
+ - dec
112
+ day_names:
113
+ - zondag
114
+ - maandag
115
+ - dinsdag
116
+ - woensdag
117
+ - donderdag
118
+ - vrijdag
119
+ - zaterdag
120
+ month_names:
121
+ -
122
+ - januari
123
+ - februari
124
+ - maart
125
+ - april
126
+ - mei
127
+ - juni
128
+ - juli
129
+ - augustus
130
+ - september
131
+ - oktober
132
+ - november
133
+ - december
@@ -127,7 +127,7 @@ sv:
127
127
  - Aug
128
128
  - Sep
129
129
  - Okt
130
- - Mov
130
+ - Nov
131
131
  - Dec
132
132
  day_names:
133
133
  - Söndag
@@ -1,9 +1,7 @@
1
1
  module IceCube
2
-
3
2
  class HashBuilder
4
-
5
3
  def initialize(rule = nil)
6
- @hash = { :validations => {}, :rule_type => rule.class.name }
4
+ @hash = {validations: {}, rule_type: rule.class.name}
7
5
  end
8
6
 
9
7
  def validations
@@ -21,7 +19,5 @@ module IceCube
21
19
  def to_hash
22
20
  @hash
23
21
  end
24
-
25
22
  end
26
-
27
23
  end
@@ -1,8 +1,6 @@
1
1
  module IceCube
2
-
3
2
  class IcalBuilder
4
-
5
- ICAL_DAYS = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA']
3
+ ICAL_DAYS = ["SU", "MO", "TU", "WE", "TH", "FR", "SA"]
6
4
 
7
5
  def initialize
8
6
  @hash = {}
@@ -19,41 +17,41 @@ module IceCube
19
17
  # Build for a single rule entry
20
18
  def to_s
21
19
  arr = []
22
- if freq = @hash.delete('FREQ')
23
- arr << "FREQ=#{freq.join(',')}"
20
+ if (freq = @hash.delete("FREQ"))
21
+ arr << "FREQ=#{freq.join(",")}"
24
22
  end
25
23
  arr.concat(@hash.map do |key, value|
26
24
  if value.is_a?(Array)
27
- "#{key}=#{value.join(',')}"
25
+ "#{key}=#{value.join(",")}"
28
26
  end
29
27
  end.compact)
30
- arr.join(';')
28
+ arr.join(";")
31
29
  end
32
30
 
33
31
  def self.ical_utc_format(time)
34
32
  time = time.dup.utc
35
- IceCube::I18n.l(time, format: '%Y%m%dT%H%M%SZ') # utc time
33
+ IceCube::I18n.l(time, format: "%Y%m%dT%H%M%SZ") # utc time
36
34
  end
37
35
 
38
36
  def self.ical_format(time, force_utc)
39
37
  time = time.dup.utc if force_utc
40
38
  if time.utc?
41
- ":#{IceCube::I18n.l(time, format: '%Y%m%dT%H%M%SZ')}" # utc time
39
+ ":#{IceCube::I18n.l(time, format: "%Y%m%dT%H%M%SZ")}" # utc time
42
40
  else
43
- ";TZID=#{IceCube::I18n.l(time, format: '%Z:%Y%m%dT%H%M%S')}" # local time specified
41
+ ";TZID=#{IceCube::I18n.l(time, format: "%Z:%Y%m%dT%H%M%S")}" # local time specified
44
42
  end
45
43
  end
46
44
 
47
45
  def self.ical_duration(duration)
48
- hours = duration / 3600; duration %= 3600
49
- minutes = duration / 60; duration %= 60
50
- repr = ''
46
+ hours = duration / 3600
47
+ duration %= 3600
48
+ minutes = duration / 60
49
+ duration %= 60
50
+ repr = ""
51
51
  repr << "#{hours}H" if hours > 0
52
52
  repr << "#{minutes}M" if minutes > 0
53
53
  repr << "#{duration}S" if duration > 0
54
54
  "PT#{repr}"
55
55
  end
56
-
57
56
  end
58
-
59
57
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  class StringBuilder
4
-
5
3
  attr_writer :base
6
4
 
7
5
  def initialize
@@ -13,15 +11,15 @@ module IceCube
13
11
  end
14
12
 
15
13
  def to_s
16
- string = @base || ''
14
+ string = @base || ""
17
15
  @types.each do |type, segments|
18
- if f = self.class.formatter(type)
16
+ if (f = self.class.formatter(type))
19
17
  current = f.call(segments)
20
18
  else
21
19
  next if segments.empty?
22
20
  current = self.class.sentence(segments)
23
21
  end
24
- f = IceCube::I18n.t('ice_cube.string.format')[type] ? type : 'default'
22
+ f = IceCube::I18n.t("ice_cube.string.format")[type] ? type : "default"
25
23
  string = IceCube::I18n.t("ice_cube.string.format.#{f}", rest: string, current: current)
26
24
  end
27
25
  string
@@ -37,14 +35,13 @@ module IceCube
37
35
  end
38
36
 
39
37
  module Helpers
40
-
41
38
  # influenced by ActiveSupport's to_sentence
42
39
  def sentence(array)
43
40
  case array.length
44
- when 0 ; ''
45
- when 1 ; array[0].to_s
46
- when 2 ; "#{array[0]}#{IceCube::I18n.t('ice_cube.array.two_words_connector')}#{array[1]}"
47
- else ; "#{array[0...-1].join(IceCube::I18n.t('ice_cube.array.words_connector'))}#{IceCube::I18n.t('ice_cube.array.last_word_connector')}#{array[-1]}"
41
+ when 0 then ""
42
+ when 1 then array[0].to_s
43
+ when 2 then "#{array[0]}#{IceCube::I18n.t("ice_cube.array.two_words_connector")}#{array[1]}"
44
+ else; "#{array[0...-1].join(IceCube::I18n.t("ice_cube.array.words_connector"))}#{IceCube::I18n.t("ice_cube.array.last_word_connector")}#{array[-1]}"
48
45
  end
49
46
  end
50
47
 
@@ -53,7 +50,7 @@ module IceCube
53
50
  end
54
51
 
55
52
  def ordinalize(number)
56
- IceCube::I18n.t('ice_cube.integer.ordinal', number: number, ordinal: ordinal(number))
53
+ IceCube::I18n.t("ice_cube.integer.ordinal", number: number, ordinal: ordinal(number))
57
54
  end
58
55
 
59
56
  def literal_ordinal(number)
@@ -63,14 +60,11 @@ module IceCube
63
60
  def ordinal(number)
64
61
  ord = IceCube::I18n.t("ice_cube.integer.ordinals")[number] ||
65
62
  IceCube::I18n.t("ice_cube.integer.ordinals")[number % 10] ||
66
- IceCube::I18n.t('ice_cube.integer.ordinals')[:default]
67
- number >= 0 ? ord : IceCube::I18n.t("ice_cube.integer.negative", ordinal: ord)
63
+ IceCube::I18n.t("ice_cube.integer.ordinals")[:default]
64
+ (number >= 0) ? ord : IceCube::I18n.t("ice_cube.integer.negative", ordinal: ord)
68
65
  end
69
-
70
66
  end
71
67
 
72
68
  extend Helpers
73
-
74
69
  end
75
-
76
70
  end
@@ -1,13 +1,12 @@
1
1
  module IceCube
2
2
  module Deprecated
3
-
4
3
  # Define a deprecated alias for a method
5
4
  # @param [Symbol] name - name of method to define
6
5
  # @param [Symbol] replacement - name of method to replace (alias)
7
6
  def deprecated_alias(name, replacement)
8
7
  # Create a wrapped version
9
8
  define_method(name) do |*args, &block|
10
- warn "IceCube: #{self.class}##{name} is deprecated (use #{replacement})", caller[0]
9
+ warn "IceCube: #{self.class}##{name} is deprecated (use #{replacement})", caller(1..1).first
11
10
  send replacement, *args, &block
12
11
  end
13
12
  end
@@ -21,7 +20,7 @@ module IceCube
21
20
  alias_method old_name, name
22
21
  # And replace it with a wrapped version
23
22
  define_method(name) do |*args, &block|
24
- warn "IceCube: #{self.class}##{name} is deprecated (use #{replacement})", caller[0]
23
+ warn "IceCube: #{self.class}##{name} is deprecated (use #{replacement})", caller(1..1).first
25
24
  send old_name, *args, &block
26
25
  end
27
26
  end
@@ -29,7 +28,7 @@ module IceCube
29
28
  def self.schedule_options(schedule, options)
30
29
  if options[:start_date_override]
31
30
  warn "IceCube: :start_date_override option is deprecated " \
32
- "(use a block: `{|s| s.start_time = override }`)", caller[0]
31
+ "(use a block: `{|s| s.start_time = override }`)", caller(1..1).first
33
32
  schedule.start_time = options[:start_date_override]
34
33
  end
35
34
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  # An exception for when a count on a Rule is passed
4
3
  class CountExceeded < StopIteration
5
4
  end
6
-
7
5
  end
@@ -1,7 +1,5 @@
1
1
  module IceCube
2
-
3
2
  # An exception for when an until date on a Rule is passed
4
3
  class UntilExceeded < StopIteration
5
4
  end
6
-
7
5
  end