lunartic 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e256a60b5df209f5cba271423f7c3434b7f20110
4
+ data.tar.gz: 2a321ccef2d9ff40b7081dbcd052cd29d682d359
5
+ SHA512:
6
+ metadata.gz: 8c6f3850949fe47ecd662de958f5880feac285c687287e25aed169b6e5d747090af3488f1ec99c1deb7590b97ce205af97bacce1111cf1a88ebd0eee8cf91f4b
7
+ data.tar.gz: 3e82e40b601a6b57942fee80879d7cbe74e4957d0f9f67609ff57f7e52be527bccad9a5d03d83c7a3efdfd363bbb8d01a8052faef49b79d825676b2c52f262f3
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
4
+ - 2.1.1
5
+ - 2.1.0
6
+ - 2.0.0
7
+ - 1.9.3
@@ -2,9 +2,8 @@ module Lunartic
2
2
  class Moon
3
3
  attr_reader :date
4
4
 
5
- # TODO: we can achieve greater accuracy by adding more
6
- # known new moon dates and using the closest one
7
- KNOWN_NEW_MOON = Date.new 1900, 1, 1
5
+ KNOWN_NEW_MOONS = [Date.new(1800, 1, 25), Date.new(1900, 1, 1),
6
+ Date.new(2000, 1, 6), Date.new(2100, 1, 10)]
8
7
 
9
8
  SYNODIC_MONTH = 29.530588853
10
9
  HALF_SYNODIC_MONTH = 29.530588853 / 2
@@ -15,7 +14,8 @@ module Lunartic
15
14
  end
16
15
 
17
16
  def day
18
- day = ((@date.jd - KNOWN_NEW_MOON.jd) % SYNODIC_MONTH).floor
17
+ closest_known = KNOWN_NEW_MOONS.select { |d| d < @date}.max || KNOWN_NEW_MOONS.first
18
+ day = ((@date.jd - closest_known.jd) % SYNODIC_MONTH).floor
19
19
  return 0 if day >= SYNODIC_MONTH.floor
20
20
  day
21
21
  end
@@ -45,4 +45,5 @@ module Lunartic
45
45
  end
46
46
  end
47
47
  end
48
- end
48
+ end
49
+
@@ -1,3 +1,3 @@
1
1
  module Lunartic
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -19,4 +19,5 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ['lib']
20
20
 
21
21
  gem.add_development_dependency 'rspec', '~> 3.0.0'
22
+ gem.add_development_dependency 'rake'
22
23
  end
@@ -67,3 +67,18 @@
67
67
  day: 0
68
68
  phase: :new
69
69
  percent_full: 0.0
70
+
71
+ - date_year: 1803
72
+ date_month: 1
73
+ date_day: 23
74
+ day: 0
75
+ phase: :new
76
+ percent_full: 0.0
77
+
78
+ - date_year: 2103
79
+ date_month: 1
80
+ date_day: 8
81
+ day: 0
82
+ phase: :new
83
+ percent_full: 0.0
84
+
@@ -1,12 +1,6 @@
1
1
  require 'lunartic'
2
2
  require 'yaml'
3
3
 
4
- RSpec.configure do |config|
5
- config.color = true
6
- config.tty = true
7
- config.formatter = :documentation
8
- end
9
-
10
4
  FIXTURES = YAML.load_file("#{File.dirname __FILE__}/fixtures/moon.yml").map do |obj|
11
5
  sym_hash = {}
12
6
  obj.each_pair do |k,v|
metadata CHANGED
@@ -1,32 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lunartic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
- prerelease:
4
+ version: 0.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brian O'Keefe
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-06-28 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: 3.0.0
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
30
41
  description: Calculate the approximate phase of the moon on a given date
31
42
  email:
32
43
  - brian@bokstuff.com
@@ -34,7 +45,8 @@ executables: []
34
45
  extensions: []
35
46
  extra_rdoc_files: []
36
47
  files:
37
- - .gitignore
48
+ - ".gitignore"
49
+ - ".travis.yml"
38
50
  - Gemfile
39
51
  - LICENSE.txt
40
52
  - README.md
@@ -50,27 +62,26 @@ files:
50
62
  homepage: https://github.com/brianokeefe/lunartic
51
63
  licenses:
52
64
  - MIT
65
+ metadata: {}
53
66
  post_install_message:
54
67
  rdoc_options: []
55
68
  require_paths:
56
69
  - lib
57
70
  required_ruby_version: !ruby/object:Gem::Requirement
58
- none: false
59
71
  requirements:
60
- - - ! '>='
72
+ - - ">="
61
73
  - !ruby/object:Gem::Version
62
74
  version: '0'
63
75
  required_rubygems_version: !ruby/object:Gem::Requirement
64
- none: false
65
76
  requirements:
66
- - - ! '>='
77
+ - - ">="
67
78
  - !ruby/object:Gem::Version
68
79
  version: '0'
69
80
  requirements: []
70
81
  rubyforge_project:
71
- rubygems_version: 1.8.23
82
+ rubygems_version: 2.3.0
72
83
  signing_key:
73
- specification_version: 3
84
+ specification_version: 4
74
85
  summary: Calculate the approximate phase of the moon on a given date
75
86
  test_files:
76
87
  - spec/fixtures/moon.yml