easter 0.1.2 → 0.2.0
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.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/easter.rb +69 -1
- metadata +50 -27
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c2d7062f0f94c0b5f9e4869073c2dd43a12d371e60ca43f30ea690da6266fac5
|
4
|
+
data.tar.gz: cfc3b97c458e0018dcdb58707ca4b81d54a756c3b262c8208bc9264a7f08f9e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb38a8021056c2b5a6297841eb22d10cf7146b17dec403f79a1705ea86413dae1ea21dea3c66dba94431aca785c66c55bfe11b8d5c7598f81f9496d28dfce440
|
7
|
+
data.tar.gz: 1c5267b5b39e14052170bb89d1a3f2f5441deeb102e4a1f2aa5ef860f6a8d256a311a277ebb850149af8959f497b82a29b159641f29d0407e7b9707075b6f0a2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/easter.rb
CHANGED
@@ -20,6 +20,7 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
require 'date'
|
23
|
+
require 'human_speakable'
|
23
24
|
|
24
25
|
class Easter
|
25
26
|
|
@@ -58,12 +59,20 @@ class Easter
|
|
58
59
|
end
|
59
60
|
|
60
61
|
end
|
62
|
+
|
63
|
+
def self.holy_thursday(some_year=Time.now.year)
|
64
|
+
easter(some_year) - 3
|
65
|
+
end
|
61
66
|
|
62
67
|
# Determine the date of Good Friday for a given year.
|
63
68
|
#
|
64
69
|
def self.good_friday(some_year=Time.now.year)
|
65
70
|
easter(some_year) - 2
|
66
71
|
end
|
72
|
+
|
73
|
+
def self.holy_saturday(some_year=Time.now.year)
|
74
|
+
easter(some_year) - 1
|
75
|
+
end
|
67
76
|
|
68
77
|
# Determine the date of Palm Sunday for a given year.
|
69
78
|
#
|
@@ -91,6 +100,65 @@ class Easter
|
|
91
100
|
|
92
101
|
end
|
93
102
|
|
103
|
+
class EasterVoice
|
104
|
+
using HumanSpeakable
|
105
|
+
|
106
|
+
def initialize(future: false)
|
107
|
+
@future = future
|
108
|
+
end
|
109
|
+
|
110
|
+
def easter() date :easter end
|
111
|
+
def ascension_day() date :ascension_day, 'Ascension day' end
|
112
|
+
def ash_wednesday() date :ash_wednesday, 'Ash Wednesday' end
|
113
|
+
def good_friday() date :good_friday, 'Good Friday' end
|
114
|
+
def holy_thursday() date :holy_thursday, 'Holy Thursday' end
|
115
|
+
def holy_saturday() date :holy_saturday, 'Holy Saturday' end
|
116
|
+
def palm_sunday() date :palm_sunday, 'Palm Sunday' end
|
117
|
+
def pentecost() date :pentecost, 'Pentecost' end
|
118
|
+
|
119
|
+
def easter_dates()
|
120
|
+
%i(ash_wednesday palm_sunday good_friday easter ascension_day pentecost)\
|
121
|
+
.map {|day| method(day).call }.join("\n")
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
def lent_start() date :ash_wednesday, 'Lent' end
|
126
|
+
def lent_end() date :holy_thursday, 'The end of Lent' end
|
127
|
+
|
128
|
+
def lent()
|
129
|
+
|
130
|
+
participle = case Date.today
|
131
|
+
when (Easter.ash_wednesday..Easter.holy_thursday) then 'is'
|
132
|
+
when (Date.new(Date.year)..Easter.ash_wednesday) then 'will be'
|
133
|
+
else
|
134
|
+
'was'
|
135
|
+
end
|
136
|
+
|
137
|
+
days = %i(ash_wednesday holy_thursday)\
|
138
|
+
.map {|x| Easter.method(x).call.humanize(year: true).sub(/on /,'') }
|
139
|
+
"Lent %s from %s to %s." % [participle, *days]
|
140
|
+
end
|
141
|
+
|
142
|
+
private
|
143
|
+
|
144
|
+
def date(s, label=s.to_s.capitalize)
|
145
|
+
|
146
|
+
d = Easter.method(s.to_sym).call
|
147
|
+
|
148
|
+
year = if d < Date.today and @future then
|
149
|
+
d = Easter.method(s.to_sym).call(Time.now.year+1)
|
150
|
+
' ' + (Time.now.year+1).to_s
|
151
|
+
else
|
152
|
+
''
|
153
|
+
end
|
154
|
+
|
155
|
+
participle = d >= Date.today ? 'is' : 'was'
|
156
|
+
r = "%s %s %s" % [label, participle, d.humanize]
|
157
|
+
r + year + '.'
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
|
94
162
|
if $0 == __FILE__ then
|
95
163
|
|
96
164
|
test_year = 2014
|
@@ -109,4 +177,4 @@ if $0 == __FILE__ then
|
|
109
177
|
|
110
178
|
puts out.join "\n"
|
111
179
|
|
112
|
-
end
|
180
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,32 +10,56 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkwMzEyMTQwNDA2WhcN
|
15
|
+
MjAwMzExMTQwNDA2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIv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k4rT9iP+9WLb6sU59/ok2e49YhITRGDAOXtT
|
31
|
+
o9hYqTrgWAoGTGA4bbo1FrXLY8NnwOOLUvMU0U35PmH2OPSvODaTS/dD2T/9Op3g
|
32
|
+
q5OWIbWW859juxlpuJaMh362Q5o+uDtfIQITlLzkjsiXPbPiI+EfKKR4a1v5ug6t
|
33
|
+
RcRhD7vHlqjaIiNUEmYx+gS8bsRpb75Czaj+M4TA8yU2VN8Xxgp2g0SSDVHvg3WO
|
34
|
+
SeWYuOIKeuB7CDRo8trpdY3OVbx2Qg/l/RuoLmHaeDWujTgoSx1Phu7CqGPtohsk
|
35
|
+
EGBRx2bgD0vhyFYpo2e56w2tqULQe+YRWNX6Jx5gQAfQtqOksWlBWb6Nt3bwx0Rr
|
36
|
+
k1sGQxBWf1KccWNeZ3xH0oQn
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
35
|
-
dependencies:
|
38
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: human_speakable
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.1'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.1.2
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.1'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.1.2
|
36
60
|
description: Returns the date for Easter, Ash Wednesday, Palm Sunday, Good Friday,
|
37
61
|
Ascension Day, and Pentecost.
|
38
|
-
email: james@
|
62
|
+
email: james@jamesrobertson.eu
|
39
63
|
executables: []
|
40
64
|
extensions: []
|
41
65
|
extra_rdoc_files: []
|
@@ -53,15 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
77
|
requirements:
|
54
78
|
- - ">="
|
55
79
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
80
|
+
version: 2.1.2
|
57
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
82
|
requirements:
|
59
83
|
- - ">="
|
60
84
|
- !ruby/object:Gem::Version
|
61
85
|
version: '0'
|
62
86
|
requirements: []
|
63
|
-
|
64
|
-
rubygems_version: 2.2.2
|
87
|
+
rubygems_version: 3.0.1
|
65
88
|
signing_key:
|
66
89
|
specification_version: 4
|
67
90
|
summary: Calculates Easter day as well as related days
|
metadata.gz.sig
CHANGED
Binary file
|