christian_calendar 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 21600e8c1e96d9ca41d1926fbad6e7ec26281fa4
4
+ data.tar.gz: 3c13c6b69f8be731a39355ee946ba3753fe657f8
5
+ SHA512:
6
+ metadata.gz: 2403987974b8935efc2adbf1a096f28da16433fbd5a8d46be94b44b0cc8252fc4e9bd017c53298ab78ad2f439c7c1131f14ce147b63f91a530840377c41c1c86
7
+ data.tar.gz: 38370772edc8440b0b8d9560e2b37fc76a649d779c6d28f71e09da589773deb29c36812aa7f2445c8b82fba7147b2409197e71c8c2eeeb9705d5fbc6686fa118
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ cI���P?kw�[-���\w�N������|�Th��5Ye���w��9��q-q�c��M4ә��9k�Y:A���R0e�V1J�b����� �H��mR������n��U�U����<<!рCg��T�׀�V_�
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ file: christian_calendar.rb
4
+
5
+ require 'easter'
6
+ require 'chronic'
7
+
8
+ MINUTE = 60
9
+ HOUR = MINUTE * 60
10
+ DAY = HOUR * 24
11
+ WEEK = DAY * 7
12
+ MONTH = DAY * 30
13
+
14
+ class ChristianCalendar
15
+
16
+ def initialize(year=Time.now.year)
17
+ @year = year
18
+ end
19
+
20
+ def epiphany()
21
+ christmas(@year - 1) + DAY * 12
22
+ end
23
+
24
+ def st_davids_day(year=@year)
25
+ Time.local(year, 3, 1)
26
+ end
27
+
28
+ alias saint_davids_day st_davids_day
29
+
30
+ def ash_wednesday()
31
+ Easter.ash_wednesday(@year)
32
+ end
33
+
34
+ def mothering_sunday()
35
+ Chronic.parse('sunday', now: ash_wednesday) + WEEK * 3
36
+ end
37
+
38
+ def st_patricks_day(year=@year)
39
+ Time.local(year, 3, 17)
40
+ end
41
+
42
+ alias saint_patricks_day st_patricks_day
43
+
44
+ def palm_sunday()
45
+ Easter.palm_sunday(@year)
46
+ end
47
+
48
+ def good_friday()
49
+ Easter.good_friday(@year)
50
+ end
51
+
52
+ def easter_sunday()
53
+ Easter.easter(@year)
54
+ end
55
+
56
+ alias easter easter_sunday
57
+
58
+ def whit_sunday()
59
+ Chronic.parse('sunday', \
60
+ now: Chronic.parse('15 May', now: Time.local(@year,1,1)))
61
+ end
62
+
63
+ def trinity_sunday()
64
+ Chronic.parse('sunday', now: pentecost)
65
+ end
66
+
67
+ def ascension_day()
68
+ Easter.ascension_day(@year)
69
+ end
70
+
71
+ def pentecost()
72
+ Easter.pentecost(@year)
73
+ end
74
+
75
+ alias pentecost_sunday pentecost
76
+
77
+ def st_andrews_day(year=@year)
78
+ Time.local(year, 11, 30)
79
+ end
80
+
81
+ alias saint_andrews_day st_andrews_day
82
+
83
+ def advent_sunday()
84
+ Chronic.parse('sunday', now: christmas) - WEEK * 4
85
+ end
86
+
87
+ def christmas(year=@year)
88
+ Time.local(year, 12, 25)
89
+ end
90
+
91
+ def to_h
92
+ a = %i(epiphany st_davids_day ash_wednesday mothering_sunday)\
93
+ + %i(st_patricks_day palm_sunday good_friday easter_sunday)\
94
+ + %i(whit_sunday trinity_sunday ascension_day pentecost st_andrews_day)\
95
+ + %i(advent_sunday christmas)
96
+
97
+ a.inject({}){|r,day| r.merge(day => method(day).call)}
98
+ end
99
+ end
100
+
101
+ if __FILE__ == $0 then
102
+
103
+ cc = ChristianCalendar.new
104
+ cc.epiphany
105
+ #cc.mothering_sunday
106
+ #cc.whit_sunday
107
+ #cc.trinity_sunday
108
+ cc.advent_sunday
109
+
110
+ cc.to_h
111
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: christian_calendar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequ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XLv3Pxp6ilnWtCt5CK9WG1Fw9Z9jnzk3
28
+ o56kEOSvc8YhyuaOn3R5Z6EGUX87y3Au4uXDxgV5ueTTL2m4ZKSNO3HHyWGzgEL8
29
+ H3XkvaqTRbv4E7Ey05ebtCRRIkxgTKjhIoADFFGWo6IJQJE0Zp6bF354H7OnaDYe
30
+ uznEPJkCsHjLSvWGNu2BPmkLVIeZriOFu/0tO2t/5JqILkDQOJ6UKM/veoedmUcY
31
+ Rg4TfVzu/dStww5/lTnRzbsQJEURD5t5AMAxy/nXLLoL27RprDvmLOOjCiId3beP
32
+ LqhBxSNMslv8uA==
33
+ -----END CERTIFICATE-----
34
+ date: 2014-01-04 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: easter
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ description: Returns the dates for Epiphany, St David's Day, Ash Wednesday, Mothering
51
+ Sunday, St Patrick's Day, Palm Sunday, Good Friday, Easter Sunday, Whit Sunday,
52
+ Trinity Sunday, Ascension Day, Pentecost Sunday, St Andrews Day, Advent Sunday,
53
+ and Christmas day
54
+ email: james@r0bertson.co.uk
55
+ executables: []
56
+ extensions: []
57
+ extra_rdoc_files: []
58
+ files:
59
+ - lib/christian_calendar.rb
60
+ homepage: https://github.com/jrobertson/christian_calendar
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.1.11
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Returns the date for Easter, Ash Wednesday, Good Friday, Trinity Sunday,
84
+ and more
85
+ test_files: []
metadata.gz.sig ADDED
Binary file