calorie 0.0.4 → 0.0.5
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.
- data/README.md +3 -3
- data/calorie.gemspec +1 -1
- data/lib/calorie/calendar.rb +0 -4
- data/lib/calorie/version.rb +1 -1
- data/lib/calorie/week.rb +0 -4
- data/spec/calendar_spec.rb +6 -6
- data/spec/calorie_spec.rb +2 -2
- data/spec/week_spec.rb +1 -1
- metadata +9 -9
data/README.md
CHANGED
@@ -25,7 +25,7 @@ The data can be anything; only your code will be interacting with it.
|
|
25
25
|
|
26
26
|
Obviously, you don't need to pass in any data -- if it's easy enough to just loop through and check what day it is and do whatever you need to do in your template, that's up to you.
|
27
27
|
|
28
|
-
Create a
|
28
|
+
Create a calendar for a month by sending in `year`, `month`, and the data:
|
29
29
|
|
30
30
|
cal = Calorie.new(2010, 6, data)
|
31
31
|
|
@@ -47,7 +47,7 @@ In your template, you can style it however you wish.
|
|
47
47
|
|
48
48
|
cal.weeks.each do |week|
|
49
49
|
# week.number
|
50
|
-
week.
|
50
|
+
week.days.each do |day|
|
51
51
|
unless day.blank?
|
52
52
|
# the day of the month is day.number
|
53
53
|
# do stuff with day.data
|
@@ -63,7 +63,7 @@ On the other hand, the definition for *week 1* is the week that has the year's f
|
|
63
63
|
|
64
64
|
If you don't need to lay it out by week, you can also iterate straight through the days (though I'm not sure why you'd use Calorie for this):
|
65
65
|
|
66
|
-
cal.
|
66
|
+
cal.days.each do |day|
|
67
67
|
# the day of the month is day.number
|
68
68
|
# do stuff with day.data
|
69
69
|
if day.today?
|
data/calorie.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.email = ["katrina.owen@gmail.com"]
|
10
10
|
s.homepage = ""
|
11
11
|
s.summary = %q{A calendar is a calendar is a calendar.}
|
12
|
-
s.description = %q{A simple
|
12
|
+
s.description = %q{A simple ruby calendar display mechanism.}
|
13
13
|
|
14
14
|
s.rubyforge_project = "calorie"
|
15
15
|
|
data/lib/calorie/calendar.rb
CHANGED
data/lib/calorie/version.rb
CHANGED
data/lib/calorie/week.rb
CHANGED
data/spec/calendar_spec.rb
CHANGED
@@ -9,7 +9,7 @@ describe Calorie::Calendar do
|
|
9
9
|
context "in the first week" do
|
10
10
|
it "numbers the days correctly" do
|
11
11
|
numbers = []
|
12
|
-
subject.weeks.first.
|
12
|
+
subject.weeks.first.days.each do |day|
|
13
13
|
numbers << day.number
|
14
14
|
end
|
15
15
|
numbers.should eq([nil, nil, nil, nil, nil, nil, 1])
|
@@ -17,7 +17,7 @@ describe Calorie::Calendar do
|
|
17
17
|
|
18
18
|
it "dates the days correctly" do
|
19
19
|
dates = []
|
20
|
-
subject.weeks.first.
|
20
|
+
subject.weeks.first.days.each do |day|
|
21
21
|
dates << day.date.to_s
|
22
22
|
end
|
23
23
|
dates.should eq(["2007-11-25", "2007-11-26", "2007-11-27", "2007-11-28", "2007-11-29", "2007-11-30", "2007-12-01"])
|
@@ -27,7 +27,7 @@ describe Calorie::Calendar do
|
|
27
27
|
context "in the last week" do
|
28
28
|
it "numbers the days correctly" do
|
29
29
|
numbers = []
|
30
|
-
subject.weeks.last.
|
30
|
+
subject.weeks.last.days.each do |day|
|
31
31
|
numbers << day.number
|
32
32
|
end
|
33
33
|
numbers.should eq([30, 31, nil, nil, nil, nil, nil])
|
@@ -35,7 +35,7 @@ describe Calorie::Calendar do
|
|
35
35
|
|
36
36
|
it "dates the days correctly" do
|
37
37
|
dates = []
|
38
|
-
subject.weeks.last.
|
38
|
+
subject.weeks.last.days.each do |day|
|
39
39
|
dates << day.date.to_s
|
40
40
|
end
|
41
41
|
dates.should eq(["2007-12-30", "2007-12-31", "2008-01-01", "2008-01-02", "2008-01-03", "2008-01-04", "2008-01-05"])
|
@@ -46,7 +46,7 @@ describe Calorie::Calendar do
|
|
46
46
|
|
47
47
|
it "creates all the days" do
|
48
48
|
numbers = []
|
49
|
-
subject.
|
49
|
+
subject.days.each do |day|
|
50
50
|
numbers << day.number
|
51
51
|
end
|
52
52
|
|
@@ -54,7 +54,7 @@ describe Calorie::Calendar do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it "hands out the data" do
|
57
|
-
subject.
|
57
|
+
subject.days.each do |day|
|
58
58
|
if day.number == 25
|
59
59
|
day.data.should eq('Christmas')
|
60
60
|
end
|
data/spec/calorie_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'calorie'
|
2
2
|
|
3
3
|
describe Calorie do
|
4
|
-
it "provides a simple
|
4
|
+
it "provides a simple decorator for a monthly calendar" do
|
5
5
|
cal = Calorie.new(2010, 12, {25 => 'Christmas'})
|
6
6
|
|
7
|
-
cal.
|
7
|
+
cal.days.each do |day|
|
8
8
|
if day.number == 25
|
9
9
|
day.data.should eq('Christmas')
|
10
10
|
end
|
data/spec/week_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calorie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2164306440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2164306440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: timecop
|
27
|
-
requirement: &
|
27
|
+
requirement: &2164306020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2164306020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: i18n
|
38
|
-
requirement: &
|
38
|
+
requirement: &2164305600 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,8 +43,8 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
description: A simple
|
46
|
+
version_requirements: *2164305600
|
47
|
+
description: A simple ruby calendar display mechanism.
|
48
48
|
email:
|
49
49
|
- katrina.owen@gmail.com
|
50
50
|
executables: []
|