greek_easter 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +16 -0
- data/VERSION +1 -0
- data/bin/greek_easter +5 -0
- data/greek_easter.gemspec +41 -0
- data/lib/greek_easter.rb +24 -0
- metadata +60 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg/*
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
require 'jeweler'
|
4
|
+
Jeweler::Tasks.new do |gemspec|
|
5
|
+
gemspec.name = "greek_easter"
|
6
|
+
gemspec.summary = "Never wonder again when easter is in Greece."
|
7
|
+
gemspec.description = "Never wonder again when easter is in Greece."
|
8
|
+
gemspec.email = "contact@jimeh.me"
|
9
|
+
gemspec.homepage = "http://github.com/jimeh/greek_easter"
|
10
|
+
gemspec.executables = ["greek_easter"]
|
11
|
+
gemspec.authors = ["Jim Myhrberg"]
|
12
|
+
end
|
13
|
+
Jeweler::GemcutterTasks.new
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
16
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/greek_easter
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{greek_easter}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jim Myhrberg"]
|
12
|
+
s.date = %q{2010-03-05}
|
13
|
+
s.default_executable = %q{greek_easter}
|
14
|
+
s.description = %q{Never wonder again when easter is in Greece.}
|
15
|
+
s.email = %q{contact@jimeh.me}
|
16
|
+
s.executables = ["greek_easter"]
|
17
|
+
s.files = [
|
18
|
+
".gitignore",
|
19
|
+
"Rakefile",
|
20
|
+
"VERSION",
|
21
|
+
"bin/greek_easter",
|
22
|
+
"greek_easter.gemspec",
|
23
|
+
"lib/greek_easter.rb"
|
24
|
+
]
|
25
|
+
s.homepage = %q{http://github.com/jimeh/greek_easter}
|
26
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
s.rubygems_version = %q{1.3.5}
|
29
|
+
s.summary = %q{Never wonder again when easter is in Greece.}
|
30
|
+
|
31
|
+
if s.respond_to? :specification_version then
|
32
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
33
|
+
s.specification_version = 3
|
34
|
+
|
35
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
36
|
+
else
|
37
|
+
end
|
38
|
+
else
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
data/lib/greek_easter.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
class GreekEaster
|
2
|
+
|
3
|
+
def self.at(year = nil)
|
4
|
+
date = self.easter(year)
|
5
|
+
return "In the year #{date.year}, the Greek Easter is on #{date.strftime("%d %B")}.";
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.easter(year = nil)
|
9
|
+
year = Time.now.year if year.nil?
|
10
|
+
year = year.to_i if year.is_a?(String)
|
11
|
+
a = year % 19
|
12
|
+
b = year % 4
|
13
|
+
c = year % 7
|
14
|
+
d = (19 * a + 16) % 30
|
15
|
+
e = (2 * b + 4 * c + 6 * d) % 7;
|
16
|
+
easter = 3 + d + e;
|
17
|
+
if easter <= 30
|
18
|
+
Time.local(year, 4, easter)
|
19
|
+
else
|
20
|
+
Time.local(year, 5, (easter - 30))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: greek_easter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jim Myhrberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-03-05 00:00:00 +02:00
|
13
|
+
default_executable: greek_easter
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Never wonder again when easter is in Greece.
|
17
|
+
email: contact@jimeh.me
|
18
|
+
executables:
|
19
|
+
- greek_easter
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- Rakefile
|
27
|
+
- VERSION
|
28
|
+
- bin/greek_easter
|
29
|
+
- greek_easter.gemspec
|
30
|
+
- lib/greek_easter.rb
|
31
|
+
has_rdoc: true
|
32
|
+
homepage: http://github.com/jimeh/greek_easter
|
33
|
+
licenses: []
|
34
|
+
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options:
|
37
|
+
- --charset=UTF-8
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
requirements: []
|
53
|
+
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.3.5
|
56
|
+
signing_key:
|
57
|
+
specification_version: 3
|
58
|
+
summary: Never wonder again when easter is in Greece.
|
59
|
+
test_files: []
|
60
|
+
|