calorie 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
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 decorator for a month by sending in `year`, `month`, and the data:
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.each_day do |day|
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.each_day do |day|
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?
@@ -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, ruby calendar decorator.}
12
+ s.description = %q{A simple ruby calendar display mechanism.}
13
13
 
14
14
  s.rubyforge_project = "calorie"
15
15
 
@@ -29,10 +29,6 @@ module Calorie
29
29
  end
30
30
  end
31
31
 
32
- def each_day(&block)
33
- days.each {|day| block.call(day) }
34
- end
35
-
36
32
  def days_of_the_week
37
33
  unless @days_of_the_week
38
34
  @days_of_the_week ||= (0..6).map do |i|
@@ -1,3 +1,3 @@
1
1
  module Calorie
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -6,10 +6,6 @@ module Calorie
6
6
  @days = days
7
7
  end
8
8
 
9
- def each_day(&block)
10
- days.each {|day| block.call(day) }
11
- end
12
-
13
9
  def number
14
10
  (thursday.date.yday / 7.0).ceil
15
11
  end
@@ -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.each_day do |day|
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.each_day do |day|
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.each_day do |day|
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.each_day do |day|
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.each_day do |day|
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.each_day do |day|
57
+ subject.days.each do |day|
58
58
  if day.number == 25
59
59
  day.data.should eq('Christmas')
60
60
  end
@@ -1,10 +1,10 @@
1
1
  require 'calorie'
2
2
 
3
3
  describe Calorie do
4
- it "provides a simple presenter for a monthly calendar" do
4
+ it "provides a simple decorator for a monthly calendar" do
5
5
  cal = Calorie.new(2010, 12, {25 => 'Christmas'})
6
6
 
7
- cal.each_day do |day|
7
+ cal.days.each do |day|
8
8
  if day.number == 25
9
9
  day.data.should eq('Christmas')
10
10
  end
@@ -19,7 +19,7 @@ describe Calorie::Week do
19
19
 
20
20
  it "loops through the days" do
21
21
  numbers = []
22
- week.each_day do |day|
22
+ week.days.each do |day|
23
23
  numbers << day.number
24
24
  end
25
25
 
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
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-22 00:00:00.000000000Z
12
+ date: 2011-12-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2156393140 !ruby/object:Gem::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: *2156393140
24
+ version_requirements: *2164306440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: timecop
27
- requirement: &2156392720 !ruby/object:Gem::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: *2156392720
35
+ version_requirements: *2164306020
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: i18n
38
- requirement: &2156392300 !ruby/object:Gem::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: *2156392300
47
- description: A simple, ruby calendar decorator.
46
+ version_requirements: *2164305600
47
+ description: A simple ruby calendar display mechanism.
48
48
  email:
49
49
  - katrina.owen@gmail.com
50
50
  executables: []