when_easter 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,7 +8,7 @@ It's still being developed and refactored, so beware ;) Binaries work well thoug
8
8
 
9
9
  ### Use
10
10
 
11
- $ when_easter
11
+ $ when_easter #the default year is current year
12
12
  In the year 2011, the Roman Easter is on 24 April.
13
13
  In the year 2011, the Greek Easter is on 24 April.
14
14
  In the year 2010 the distance between Roman and Greek Easter is 0 week(s).
@@ -33,7 +33,11 @@ If you wish, you can also use WhenEaster::EasterCalendar class and its methods t
33
33
 
34
34
 
35
35
  roman_date = WhenEaster::EasterCalendar.find_roman_easter_date(2010)
36
- greek date is similiar - you can get it by replacing roman with greek
36
+ or, if you wan't to play more with EasterCalendar instance,
37
+
38
+ my_calendar = WhenEaster::EasterCalendar.new(2010) #if you want to get data for the year 2010
39
+ another_roman_date = my_calendar.roman_easter
40
+ greek date is similiar - you can get it by replacing roman with greek
37
41
 
38
42
  And get
39
43
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -13,10 +13,10 @@ When /^I ask for the year$/ do
13
13
  @year = @easter_calendar.year
14
14
  end
15
15
  When /^I find roman easter$/ do
16
- @roman_date = @easter_calendar.class.find_roman_easter_date(@easter_calendar.year)
16
+ @roman_date = @easter_calendar.roman_easter
17
17
  end
18
18
  When /^I find greek easter$/ do
19
- @greek_date = @easter_calendar.class.find_greek_easter_date(@easter_calendar.year)
19
+ @greek_date = @easter_calendar.greek_easter
20
20
  end
21
21
  Then /^I should see year (\d+) in an easter_calendar$/ do |year|
22
22
  @year.should == year.to_i
@@ -1,24 +1,24 @@
1
1
  module WhenEaster
2
2
  class EasterCalendar
3
3
 
4
- attr_reader :year
4
+ attr_reader :year, :roman_easter, :greek_easter, :distance_in_weeks
5
5
  def initialize(year = nil)
6
6
  @year = Time.now.year if year.nil?
7
7
  @year = year if year.is_a?(Integer)
8
8
  @year = year.to_i if year.is_a?(String)
9
- end
10
- def distance_in_weeks
11
- ((self.class.find_greek_easter_date(year) - self.class.find_roman_easter_date(year))/3600/24/7).to_i
9
+ @roman_easter = self.class.find_roman_easter_date(@year)
10
+ @greek_easter = self.class.find_greek_easter_date(@year)
11
+ @distance_in_weeks = ((@greek_easter-@roman_easter)/3600/24/7).to_i
12
12
  end
13
13
  def find
14
14
  find_roman+"\n"+find_greek+"\n"+find_distance
15
15
  end
16
16
 
17
17
  def find_roman
18
- "In the year #{@year} the Roman Easter is on #{self.class.find_roman_easter_date(@year).strftime("%d %B")}."
18
+ "In the year #{@year} the Roman Easter is on #{@roman_easter.strftime("%d %B")}."
19
19
  end
20
20
  def find_greek
21
- "In the year #{@year} the Greek Easter is on #{self.class.find_greek_easter_date(@year).strftime("%d %B")}."
21
+ "In the year #{@year} the Greek Easter is on #{@greek_easter.strftime("%d %B")}."
22
22
  end
23
23
  def find_distance
24
24
  "In the year #{@year} the distance between Roman and Greek Easter is #{distance_in_weeks} week(s)."
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{when_easter}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Michał Nierebiński}]
12
- s.date = %q{2011-07-14}
12
+ s.date = %q{2011-07-15}
13
13
  s.description = %q{A tool that calculates the dates of Roman and Greek Easter.}
14
14
  s.email = %q{michal@nierebinski.pl}
15
15
  s.executables = [%q{find_distance}, %q{when_roman_easter}, %q{when_greek_easter}, %q{when_easter}]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: when_easter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Micha\xC5\x82 Nierebi\xC5\x84ski"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-14 00:00:00 Z
18
+ date: 2011-07-15 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement