feast_fast 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/lib/feast_fast/calculator.rb +1 -1
- data/lib/feast_fast/date.rb +11 -2
- data/lib/feast_fast/db.rb +8 -6
- data/lib/feast_fast/version.rb +1 -1
- metadata +22 -39
data/README.md
CHANGED
@@ -38,10 +38,14 @@ if days_till_easter > 50
|
|
38
38
|
if today.feasts.any?
|
39
39
|
puts "Don't be sad, today you can celebrate #{today.feasts.first}"
|
40
40
|
else
|
41
|
-
remaining_feasts = Date.with_feasts(
|
41
|
+
remaining_feasts = Date.with_feasts(
|
42
|
+
today.year,
|
43
|
+
FeastFast::Feast::STATUS::TWELVE,
|
44
|
+
FeastFast::Feast::STATUS::GREAT
|
45
|
+
).drop_while{ |feast_day| feast_day <= today }
|
42
46
|
if remaining_feasts.size > 1
|
43
47
|
puts "Don't be sad, there are still #{remaining_feasts.size} Great Feasts in this year:"
|
44
|
-
remaining_feasts.
|
48
|
+
remaining_feasts.each { |date| puts "At #{date.strftime('%d %b')}: #{date.feasts.first}" }
|
45
49
|
end
|
46
50
|
end
|
47
51
|
puts "And don't forget to fast today!" if today.fast?
|
data/lib/feast_fast/date.rb
CHANGED
@@ -16,8 +16,8 @@ class Date
|
|
16
16
|
self.new(year, m, d) + 13
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.with_feasts(year,
|
20
|
-
FeastFast::DB.feasts(year,
|
19
|
+
def self.with_feasts(year, *statuses)
|
20
|
+
FeastFast::DB.feasts(year, *statuses).keys.sort
|
21
21
|
end
|
22
22
|
|
23
23
|
def feasts
|
@@ -37,6 +37,15 @@ class Date
|
|
37
37
|
|
38
38
|
def feasts?() self.feasts.any? end
|
39
39
|
|
40
|
+
def next_with_feast(*statuses)
|
41
|
+
self.class.with_feasts(self.year, *statuses).find{|d| d > self } || self.class.with_feasts(self.year + 1, *statuses).first
|
42
|
+
end
|
43
|
+
|
44
|
+
def prev_with_feast(*statuses)
|
45
|
+
self.class.with_feasts(self.year, *statuses).reverse.find{|d| d < self } || self.class.with_feasts(self.year - 1, *statuses).last
|
46
|
+
end
|
47
|
+
|
48
|
+
|
40
49
|
def next_date(n=1) self + n end
|
41
50
|
def prev_date(n=1) self - n end
|
42
51
|
|
data/lib/feast_fast/db.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module FeastFast
|
2
2
|
module DB
|
3
3
|
def self.data(year)
|
4
|
-
year = year.to_i
|
5
4
|
return @data[year] if @data && @data.has_key?( year )
|
6
5
|
|
7
6
|
@data ||= {}
|
@@ -20,12 +19,15 @@ module FeastFast
|
|
20
19
|
self.data(date.year)[:days][date]
|
21
20
|
end
|
22
21
|
|
23
|
-
def self.feasts(year,
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
def self.feasts(year, *params)
|
23
|
+
days = self.data(year)[:days].select do |date, hash|
|
24
|
+
if params.any?
|
25
|
+
hash[:feasts].map{|feast| params.include? feast.status}.any?
|
26
|
+
else
|
27
|
+
hash[:feasts].any?
|
28
|
+
end
|
27
29
|
end
|
30
|
+
Hash[days]
|
28
31
|
end
|
29
|
-
|
30
32
|
end
|
31
33
|
end
|
data/lib/feast_fast/version.rb
CHANGED
metadata
CHANGED
@@ -1,33 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: feast_fast
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- ilzoff
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-06-08 00:00:00 Z
|
12
|
+
date: 2012-06-09 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
|
22
|
-
email:
|
14
|
+
description: Feasts and Fasts of Eastern Orthodox Church hardcoded and calculated
|
15
|
+
based on easter.
|
16
|
+
email:
|
23
17
|
- il.zoff@gmail.com
|
24
|
-
executables:
|
18
|
+
executables:
|
25
19
|
- feast_fast
|
26
20
|
extensions: []
|
27
|
-
|
28
21
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
22
|
+
files:
|
31
23
|
- .gitignore
|
32
24
|
- Gemfile
|
33
25
|
- LICENSE
|
@@ -43,37 +35,28 @@ files:
|
|
43
35
|
- lib/feast_fast/feast.rb
|
44
36
|
- lib/feast_fast/version.rb
|
45
37
|
homepage: https://github.com/ilzoff/feast_fast
|
46
|
-
licenses:
|
38
|
+
licenses:
|
47
39
|
- MIT
|
48
40
|
post_install_message:
|
49
41
|
rdoc_options: []
|
50
|
-
|
51
|
-
require_paths:
|
42
|
+
require_paths:
|
52
43
|
- lib
|
53
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
54
45
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
|
60
|
-
- 0
|
61
|
-
version: "0"
|
62
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
51
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
|
68
|
-
segments:
|
69
|
-
- 0
|
70
|
-
version: "0"
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
71
56
|
requirements: []
|
72
|
-
|
73
57
|
rubyforge_project:
|
74
58
|
rubygems_version: 1.8.24
|
75
59
|
signing_key:
|
76
60
|
specification_version: 3
|
77
61
|
summary: Feasts and Fasts of Eastern Orthodox Church hardcoded and calculated
|
78
62
|
test_files: []
|
79
|
-
|