solunar 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solunar.rb +29 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b39e7ad43cb9de235dbbf1e86ebfa7e95c83fed
|
4
|
+
data.tar.gz: a0eba39715589ab39f8d404cb34e37a63e6d97de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aa8fcc0c1a48af0f8724b4998af600afaa0f614f50a274ed45d49bfc7449d37f8c632e295dc75cd8c2915dc04283e6f06754d631c037aff3ef1fec88d3bfe26
|
7
|
+
data.tar.gz: d901bb63b8fbf9dc3f1dfa3dc91c7f876aca9fc12a808c9c7472a39ce7d5bbeab46eebb4f0f6efe865d277d5030f585652f38ba262f72112f333d8edad158bac
|
data/lib/solunar.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
class Solunar
|
2
2
|
|
3
3
|
NAME = "solunar"
|
4
|
-
VERSION = '0.0.
|
4
|
+
VERSION = '0.0.8'
|
5
5
|
def version
|
6
|
-
"0.0.
|
6
|
+
"0.0.8"
|
7
7
|
end
|
8
8
|
|
9
9
|
def test
|
@@ -34,19 +34,19 @@ class Solunar
|
|
34
34
|
moon[:transit] = segments[6].strip[0..-4] unless segments[6].strip == "NONE"
|
35
35
|
day[:under_foot] = segments[8].strip[0..-4] unless segments[8].strip == "NONE"
|
36
36
|
unless moon[:rise].nil?
|
37
|
-
minor_feed_times << { start: moon[:rise], stop:
|
37
|
+
minor_feed_times << { start: add_minutes(moon[:rise],-45), stop: add_minutes(moon[:rise],45) }
|
38
38
|
end
|
39
39
|
unless moon[:set].nil?
|
40
|
-
minor_feed_times << { start: moon[:set], stop:
|
40
|
+
minor_feed_times << { start: add_minutes(moon[:set],-45), stop: add_minutes(moon[:set],45) }
|
41
41
|
end
|
42
42
|
unless moon[:rise].nil? || moon[:set].nil? || moon[:rise].split(":").first.to_i < moon[:set].split(":").first.to_i
|
43
43
|
minor_feed_times.rotate!
|
44
44
|
end
|
45
45
|
unless moon[:transit].nil?
|
46
|
-
major_feed_times << { start: moon[:transit], stop:
|
46
|
+
major_feed_times << { start: add_minutes(moon[:transit],-90), stop: add_minutes(moon[:transit],90) }
|
47
47
|
end
|
48
48
|
unless day[:under_foot].nil?
|
49
|
-
major_feed_times << { start: day[:under_foot], stop:
|
49
|
+
major_feed_times << { start: add_minutes(day[:under_foot],-90), stop: add_minutes(day[:under_foot],90) }
|
50
50
|
end
|
51
51
|
unless moon[:transit].nil? || day[:under_foot].nil? || moon[:transit].split(":").first.to_i < day[:under_foot].split(":").first.to_i
|
52
52
|
major_feed_times.rotate!
|
@@ -76,5 +76,28 @@ class Solunar
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
+
def add_minutes(str,num)
|
80
|
+
segs = str.split(":")
|
81
|
+
hour = segs[0].to_i
|
82
|
+
minutes = segs[1].to_i
|
83
|
+
minutes += num
|
84
|
+
while(minutes > 59)
|
85
|
+
minutes -= 60
|
86
|
+
hour += 1
|
87
|
+
end
|
88
|
+
while(minutes < 0)
|
89
|
+
minutes += 60
|
90
|
+
hour -= 1
|
91
|
+
end
|
92
|
+
minutes = "0".to_s + minutes.to_s if minutes < 10
|
93
|
+
hour += 24 if hour < 0
|
94
|
+
hour -= 24 if hour > 23
|
95
|
+
if hour > 9
|
96
|
+
return "#{hour.to_s}:#{minutes.to_s}"
|
97
|
+
else
|
98
|
+
return "0#{hour.to_s}:#{minutes.to_s}"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
79
102
|
end
|
80
103
|
require 'solunar/solunar'
|