Skip to content

Commit 5674c69

Browse files
committed
Whitespace cleanup throught remaining code
1 parent a771178 commit 5674c69

20 files changed

+75
-75
lines changed

Rakefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'rspec/core/rake_task'
22
require File.dirname(__FILE__) + '/lib/ice_cube/version'
3-
3+
44
task :build => :test do
55
system "gem build ice_cube.gemspec"
66
end
@@ -12,7 +12,7 @@ task :release => :build do
1212
# push the gem
1313
system "gem push ice_cube-#{IceCube::VERSION}.gem"
1414
end
15-
15+
1616
RSpec::Core::RakeTask.new(:test) do |t|
1717
t.pattern = 'spec/**/*_spec.rb'
1818
fail_on_error = true # be explicit

ice_cube.gemspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
require File.dirname(__FILE__) + '/lib/ice_cube/version'
22

33
spec = Gem::Specification.new do |s|
4-
5-
s.name = 'ice_cube'
4+
5+
s.name = 'ice_cube'
66
s.author = 'John Crepezzi'
77
s.add_development_dependency('rspec')
88
s.add_development_dependency('active_support', '>= 3.0.0')

lib/ice_cube/builders/hash_builder.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module IceCube
22

33
class HashBuilder
4-
4+
55
def initialize(rule = nil)
66
@hash = { :validations => {}, :rule_type => rule.class.name }
77
end

lib/ice_cube/builders/string_builder.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def register_formatter(type, &formatter)
4141
class << self
4242

4343
NUMBER_SUFFIX = ['th', 'st', 'nd', 'rd', 'th', 'th', 'th', 'th', 'th', 'th']
44-
SPECIAL_SUFFIX = { 11 => 'th', 12 => 'th', 13 => 'th', 14 => 'th' }
45-
44+
SPECIAL_SUFFIX = { 11 => 'th', 12 => 'th', 13 => 'th', 14 => 'th' }
45+
4646
# influenced by ActiveSupport's to_sentence
4747
def sentence(array)
4848
case array.length
@@ -63,12 +63,12 @@ def nice_number(number)
6363
else
6464
suffix = SPECIAL_SUFFIX.include?(number) ?
6565
SPECIAL_SUFFIX[number] : NUMBER_SUFFIX[number.abs % 10]
66-
number.to_s << suffix
66+
number.to_s << suffix
6767
end
6868
end
6969

7070
end
71-
71+
7272
end
7373

7474
end

lib/ice_cube/rules/secondly_rule.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module IceCube
22

33
class SecondlyRule < ValidatedRule
4-
4+
55
include Validations::SecondlyInterval
66

77
def initialize(interval = 1)

lib/ice_cube/schedule.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def self.from_hash(original_hash, options = {})
314314
schedule = IceCube::Schedule.new TimeUtil.deserialize_time(data[:start_date])
315315
schedule.duration = data[:duration] if data[:duration]
316316
schedule.end_time = TimeUtil.deserialize_time(data[:end_time]) if data[:end_time]
317-
data[:rrules] && data[:rrules].each { |h| schedule.rrule(IceCube::Rule.from_hash(h)) }
317+
data[:rrules] && data[:rrules].each { |h| schedule.rrule(IceCube::Rule.from_hash(h)) }
318318
data[:exrules] && data[:exrules].each { |h| schedule.exrule(IceCube::Rule.from_hash(h)) }
319319
data[:rtimes] && data[:rtimes].each do |t|
320320
schedule.add_recurrence_time TimeUtil.deserialize_time(t)

lib/ice_cube/validations/count.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def build_ical(builder)
4545
end
4646

4747
StringBuilder.register_formatter(:count) do |segments|
48-
count = segments.first
48+
count = segments.first
4949
"#{count} #{count == 1 ? 'time' : 'times'}"
5050
end
5151

lib/ice_cube/validations/day.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module IceCube
44

55
module Validations::Day
6-
6+
77
def day(*days)
88
days.each do |day|
99
day = TimeUtil.symbol_to_day(day) if day.is_a?(Symbol)

lib/ice_cube/validations/hourly_interval.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def dst_adjust?
4242

4343
def validate(time, schedule)
4444
start_time = schedule.start_time
45-
sec = (time.to_i - time.to_i % ONE_HOUR) -
45+
sec = (time.to_i - time.to_i % ONE_HOUR) -
4646
(start_time.to_i - start_time.to_i % ONE_HOUR)
4747
hours = sec / ONE_HOUR
4848
unless hours % interval == 0

lib/ice_cube/validations/lock.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def validate_day_lock(time, schedule)
2323
# If this number is positive, then follow our normal procedure
2424
if start > 0
2525
return start >= time.day ? start - time.day : days_in_this_month - time.day + start
26-
end
26+
end
2727
# If the number is negative, and it resolved against the current month
2828
# puts it in the future, just return the difference
2929
days_in_this_month = TimeUtil.days_in_month(time)
30-
start_one = days_in_this_month + start + 1
30+
start_one = days_in_this_month + start + 1
3131
if start_one >= time.day
3232
return start_one - time.day
3333
end

lib/ice_cube/validations/weekly_interval.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def validate(time, schedule)
4545
st = schedule.start_time
4646
start_date = Date.new(st.year, st.month, st.day)
4747
weeks = (
48-
(date - TimeUtil.normalize_weekday(date.wday, week_start)) -
48+
(date - TimeUtil.normalize_weekday(date.wday, week_start)) -
4949
(start_date - TimeUtil.normalize_weekday(start_date.wday, week_start))
5050
) / 7
5151
unless weeks % interval == 0

spec/data/issue40.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
:rrules:
44
- :rule_type: IceCube::MinutelyRule
55
:interval: 60
6-
:until: !!null
7-
:count: !!null
6+
:until: !!null
7+
:count: !!null
88
:validations:
99
:day:
1010
- 4
@@ -18,4 +18,4 @@
1818
:rdates: []
1919
:exdates: []
2020
:duration: 3600
21-
:end_time: !!null
21+
:end_time: !!null

spec/examples/dst_spec.rb

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
dates.each do |date|
1414
date.utc?.should_not == true
1515
date.hour.should == 5
16-
end
16+
end
1717
end
1818

1919
# DST in 2010 is November 7th at 2am
@@ -27,9 +27,9 @@
2727
dates.each do |date|
2828
date.utc?.should_not == true
2929
date.hour.should == 5
30-
end
30+
end
3131
end
32-
32+
3333
it 'cross a daylight savings time boundary with a recurrence rule in local time' do
3434
start_date = Time.local(2010, 3, 14, 5, 0, 0)
3535
schedule = IceCube::Schedule.new(start_date)
@@ -55,7 +55,7 @@
5555
distance_in_hours += 2
5656
end
5757
end
58-
58+
5959
it 'every 30 minutes over a daylight savings time boundary, checking interval' do
6060
start_date = Time.local(2010, 11, 6, 23, 0, 0)
6161
schedule = IceCube::Schedule.new(start_date)
@@ -68,7 +68,7 @@
6868
distance_in_minutes += 30
6969
end
7070
end
71-
71+
7272
it 'every 120 seconds over a daylight savings time boundary, checking interval' do
7373
start_date = Time.local(2010, 11, 6, 23, 50, 0)
7474
schedule = IceCube::Schedule.new(start_date)
@@ -81,7 +81,7 @@
8181
distance_in_seconds += 120
8282
end
8383
end
84-
84+
8585
it 'every other day over a daylight savings time boundary, checking hour/min/sec' do
8686
start_date = Time.local(2010, 11, 6, 20, 0, 0)
8787
schedule = IceCube::Schedule.new(start_date)
@@ -94,7 +94,7 @@
9494
d.sec.should == start_date.sec
9595
end
9696
end
97-
97+
9898
it 'every other month over a daylight savings time boundary, checking day/hour/min/sec' do
9999
start_date = Time.local(2010, 11, 6, 20, 0, 0)
100100
schedule = IceCube::Schedule.new(start_date)
@@ -108,7 +108,7 @@
108108
d.sec.should == start_date.sec
109109
end
110110
end
111-
111+
112112
it 'every other year over a daylight savings time boundary, checking day/hour/min/sec' do
113113
start_date = Time.local(2010, 11, 6, 20, 0, 0)
114114
schedule = IceCube::Schedule.new(start_date)
@@ -123,7 +123,7 @@
123123
d.sec.should == start_date.sec
124124
end
125125
end
126-
126+
127127
it 'LOCAL - has an until date on a rule that is over a DST from the start date' do
128128
start_date = Time.local(2010, 3, 13, 5, 0, 0)
129129
end_date = Time.local(2010, 3, 15, 5, 0, 0)
@@ -159,7 +159,7 @@
159159
#make sure we end on the proper time
160160
schedule.all_occurrences.last.should == end_date
161161
end
162-
162+
163163
it 'LOCAL - has an end date on a rule that is over a DST from the start date' do
164164
start_date = Time.local(2010, 3, 13, 5, 0, 0)
165165
end_date = Time.local(2010, 3, 15, 5, 0, 0)
@@ -262,5 +262,5 @@
262262
schedule.add_recurrence_rule IceCube::Rule.yearly.month_of_year(:april).day_of_month(10)
263263
schedule.first(3).should == [Time.local(2010, 4, 10, 12, 0, 0), Time.local(2011, 4, 10, 12, 0, 0), Time.local(2012, 4, 10, 12, 0, 0)]
264264
end
265-
265+
266266
end

spec/examples/monthly_rule_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require File.dirname(__FILE__) + '/../spec_helper'
22

33
describe IceCube::MonthlyRule, 'occurs_on?' do
4-
4+
55
it 'should produce the correct number of days for @interval = 1' do
66
start_date = DAY
77
schedule = IceCube::Schedule.new(start_date)
@@ -40,7 +40,7 @@
4040
#check assumption (month 1 monday) (month 2 monday)
4141
schedule.occurrences(start_date + 50 * IceCube::ONE_DAY).size.should == 2
4242
end
43-
43+
4444
it 'should produce the correct number of days for @interval = 1 with only the last mondays' do
4545
start_date = Time.utc(2010, 1, 1)
4646
schedule = IceCube::Schedule.new(start_date)

spec/examples/regression_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
it 'should consider recurrence dates properly in find_occurreces - github issue 43' do
66
s = IceCube::Schedule.new(Time.local(2011,10,1, 18, 25))
77
s.add_recurrence_date(Time.local(2011,12,3,15,0,0))
8-
s.add_recurrence_date(Time.local(2011,12,3,10,0,0))
8+
s.add_recurrence_date(Time.local(2011,12,3,10,0,0))
99
s.add_recurrence_date(Time.local(2011,12,4,10,0,0))
1010
s.occurs_at?(Time.local(2011,12,3,15,0,0)).should be_true
1111
end

spec/examples/schedule_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179

180180
it 'should return false if conflict is not present and single recurrence and time originally specified as DateTime' do
181181
date = DateTime.new(2020,9,21,11,30,0)
182-
start_time = date.to_time
182+
start_time = date.to_time
183183
schedule1 = IceCube::Schedule.new(start_time, :duration => IceCube::ONE_HOUR)
184184
schedule1.add_recurrence_time(start_time)
185185
schedule2 = IceCube::Schedule.new(start_time + IceCube::ONE_HOUR, :duration => IceCube::ONE_HOUR)
@@ -274,7 +274,7 @@
274274
describe :start_date= do
275275

276276
it 'should modify start date in rrule_occurrence_heads when changed' do
277-
schedule = Schedule.new (Time.now - 1000)
277+
schedule = Schedule.new(Time.now - 1000)
278278
schedule.rrule Rule.daily
279279
schedule.start_date = (start_date = Time.now)
280280
(Time.now - schedule.first).should be < 100

spec/examples/to_s_spec.rb

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,37 @@
66
IceCube::Rule.secondly.to_s.should == 'Secondly'
77
IceCube::Rule.secondly(2).to_s.should == 'Every 2 seconds'
88
end
9-
9+
1010
it 'should have a useful base to_s representation for a minutely rule' do
1111
IceCube::Rule.minutely.to_s.should == 'Minutely'
1212
IceCube::Rule.minutely(2).to_s.should == 'Every 2 minutes'
1313
end
14-
14+
1515
it 'should have a useful base to_s representation for a hourly rule' do
1616
IceCube::Rule.hourly.to_s.should == 'Hourly'
1717
IceCube::Rule.hourly(2).to_s.should == 'Every 2 hours'
1818
end
19-
19+
2020
it 'should have a useful base to_s representation for a daily rule' do
2121
IceCube::Rule.daily.to_s.should == 'Daily'
2222
IceCube::Rule.daily(2).to_s.should == 'Every 2 days'
2323
end
24-
24+
2525
it 'should have a useful base to_s representation for a weekly rule' do
2626
IceCube::Rule.weekly.to_s.should == 'Weekly'
2727
IceCube::Rule.weekly(2).to_s.should == 'Every 2 weeks'
2828
end
29-
29+
3030
it 'should have a useful base to_s representation for a monthly rule' do
3131
IceCube::Rule.monthly.to_s.should == 'Monthly'
3232
IceCube::Rule.monthly(2).to_s.should == 'Every 2 months'
3333
end
34-
34+
3535
it 'should have a useful base to_s representation for a yearly rule' do
3636
IceCube::Rule.yearly.to_s.should == 'Yearly'
3737
IceCube::Rule.yearly(2).to_s.should == 'Every 2 years'
3838
end
39-
39+
4040
it 'should work with various sentence types properly' do
4141
IceCube::Rule.weekly.to_s.should == 'Weekly'
4242
IceCube::Rule.weekly.day(:monday).to_s.should == 'Weekly on Mondays'
@@ -77,7 +77,7 @@
7777
schedule.add_recurrence_date Time.local(2010, 3, 20)
7878
schedule.to_s.should == "March 20, 2010"
7979
end
80-
80+
8181
it 'should work with additional dates' do
8282
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
8383
schedule.add_recurrence_date Time.local(2010, 3, 20)
@@ -98,7 +98,7 @@
9898
schedule.add_recurrence_date Time.local(2010, 3, 20)
9999
schedule.to_s.should == 'March 20, 2010'
100100
end
101-
101+
102102
it 'should work with rules and dates' do
103103
schedule = IceCube::Schedule.new Time.local(2010, 3, 20)
104104
schedule.add_recurrence_date Time.local(2010, 3, 20)
@@ -166,7 +166,7 @@
166166
schedule.rrule IceCube::Rule.weekly.until(Time.local(2012, 2, 3))
167167
schedule.to_s.should == 'Weekly until February 3, 2012'
168168
end
169-
169+
170170
it 'should be able to reflect count' do
171171
schedule = IceCube::Schedule.new(Time.now)
172172
schedule.add_recurrence_rule IceCube::Rule.weekly.count(1)

0 commit comments

Comments
 (0)