solunar 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/solunar.rb +29 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13fa057dc2011054707cc9929a8c2a7369f2b291
4
- data.tar.gz: b4e6b156e67efbc3c01a10b7c26787d8d566e0a8
3
+ metadata.gz: 5b39e7ad43cb9de235dbbf1e86ebfa7e95c83fed
4
+ data.tar.gz: a0eba39715589ab39f8d404cb34e37a63e6d97de
5
5
  SHA512:
6
- metadata.gz: aa0c52df98f58c663bc975a05dff0ccba6b4c87c6a02f7bd0f1d0375121c57b5a3cd49b3f965d354b19569264f794afc2e6e284e34006152e422d081f951ab0d
7
- data.tar.gz: 639ed1cb17b3425b0654254a8454cdf4c65206ecdd637098256358d3547165af8f47a43b86446b9780e9a8820142e242fb38a2b3e59a7a27219cd569476f7c16
6
+ metadata.gz: 5aa8fcc0c1a48af0f8724b4998af600afaa0f614f50a274ed45d49bfc7449d37f8c632e295dc75cd8c2915dc04283e6f06754d631c037aff3ef1fec88d3bfe26
7
+ data.tar.gz: d901bb63b8fbf9dc3f1dfa3dc91c7f876aca9fc12a808c9c7472a39ce7d5bbeab46eebb4f0f6efe865d277d5030f585652f38ba262f72112f333d8edad158bac
@@ -1,9 +1,9 @@
1
1
  class Solunar
2
2
 
3
3
  NAME = "solunar"
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
  def version
6
- "0.0.7"
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: add_hours(moon[:rise],1) }
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: add_hours(moon[:set],1) }
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: add_hours(moon[:transit],2) }
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: add_hours(day[:under_foot],2) }
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'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solunar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - "\"Sullivan"