ephemeris 0.1.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: ed98c0bd43f95dc23b96e76d221ae1df606d4ab4
4
+ data.tar.gz: 366eb328dd2a1416504b348da18323d39ba8ce6c
5
+ SHA512:
6
+ metadata.gz: e135112a3d9aa089f2e65ab83f383fd290d45877650e59aa85bd0b0c36750d65946cb1649f5ce587ac21cb1923d0c20a70c246a384c7264e5121fa50f5e27e8b
7
+ data.tar.gz: 51037a89c764fbd648db10208153a5e270af800dfa73c2f83d4eb97346188f06450e7af45bf0a1f571978aa58b0a935088f48047edbb8abbaef3a36d3445b61f
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ephemeris.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Ted Nielsen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,47 @@
1
+ # Ephemeris
2
+
3
+ Ephemeris provides dignity and relationship calculations around the existing `swe4r` binding to the open source Swiss Ephemeris.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'ephemeris'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install ephemeris
20
+
21
+ ## Usage
22
+
23
+ `Ephemeris::Zodiac::Aspect` provides multiple modules (`Conjunction`, `Opposition`, `Square`, `Trine`, `Sextile`) which can be used to produce boolean results on the relationship between planets.
24
+
25
+ `Ephemeris::Zodiac::Dignity` provides boolean results for basic essential dignities (exaltation, domicile, detriment, fall) and (IMHO) and unreliable representation of triplicity. Decanate dignities are not represented (yet).
26
+
27
+ All methods expect at least one `Ephemeris::Planet` instance (Hellenistic planets supported; no outer planets or small bodies); obviously, aspect queries will expect two.
28
+
29
+ ## TODO List
30
+ * Better triplicity API
31
+ * Decans in dignity API
32
+ * Generic queries like `::dignified?` or `::afflicted?`
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome; contact me on Twitter (@thisisorval).
43
+
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "ephemeris"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "pry"
14
+ Pry.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ephemeris/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ephemeris"
8
+ spec.version = Ephemeris::VERSION
9
+ spec.authors = ["T. Orval Nielsen"]
10
+
11
+ spec.summary = %q{Ephemeris provides dignity and relationship calculations around the existing `swe4r` binding to the open source Swiss Ephemeris.}
12
+ spec.license = "MIT"
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
+ f.match(%r{^(test|spec|features)/})
16
+ end
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.13"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.5"
24
+ spec.add_development_dependency "pry", "~> 0.10.4"
25
+
26
+ spec.add_runtime_dependency "swe4r", "~> 0.0.2"
27
+ end
@@ -0,0 +1,12 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+
4
+ require 'logger'
5
+
6
+ require "ephemeris/version"
7
+ require "ephemeris/zodiac/zodiac"
8
+ require "ephemeris/planet/planet"
9
+
10
+ module Ephemeris
11
+ $logger = Logger.new(STDOUT)
12
+ end
@@ -0,0 +1,34 @@
1
+ module Ephemeris
2
+ module Planet
3
+ class Jupiter
4
+ include Ephemeris::Zodiac::Dignity
5
+ ORB = 9
6
+
7
+ attr_accessor :position
8
+
9
+ def initialize( position )
10
+ self.position = position
11
+ end
12
+
13
+ def domicile
14
+ [ Ephemeris::Zodiac::PositionMatrix::SAGITTARIUS, Ephemeris::Zodiac::PositionMatrix::PISCES ]
15
+ end
16
+
17
+ def detriment
18
+ [ Ephemeris::Zodiac::PositionMatrix::GEMINI, Ephemeris::Zodiac::PositionMatrix::VIRGO ]
19
+ end
20
+
21
+ def exaltation
22
+ Ephemeris::Zodiac::PositionMatrix::CANCER
23
+ end
24
+
25
+ def fall
26
+ Ephemeris::Zodiac::PositionMatrix::CAPRICORN
27
+ end
28
+
29
+ def triplicity
30
+ [ Ephemeris::Zodiac::PositionMatrix::ARIES, Ephemeris::Zodiac::PositionMatrix::LEO, Ephemeris::Zodiac::PositionMatrix::SAGITTARIUS, Ephemeris::Zodiac::PositionMatrix::GEMINI, Ephemeris::Zodiac::PositionMatrix::LIBRA, Ephemeris::Zodiac::PositionMatrix::AQUARIUS ]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module Ephemeris
2
+ module Planet
3
+ class Mars
4
+ include Ephemeris::Zodiac::Dignity
5
+ ORB = 7
6
+
7
+ attr_accessor :position
8
+
9
+ def initialize( position )
10
+ self.position = position
11
+ end
12
+
13
+ def domicile
14
+ [ Ephemeris::Zodiac::PositionMatrix::ARIES, Ephemeris::Zodiac::PositionMatrix::SCORPIO ]
15
+ end
16
+
17
+ def detriment
18
+ [ Ephemeris::Zodiac::PositionMatrix::TAURUS, Ephemeris::Zodiac::PositionMatrix::LIBRA ]
19
+ end
20
+
21
+ def exaltation
22
+ Ephemeris::Zodiac::PositionMatrix::CAPRICORN
23
+ end
24
+
25
+ def fall
26
+ Ephemeris::Zodiac::PositionMatrix::CANCER
27
+ end
28
+
29
+ def triplicity
30
+ [ Ephemeris::Zodiac::PositionMatrix::CANCER, Ephemeris::Zodiac::PositionMatrix::SCORPIO, Ephemeris::Zodiac::PositionMatrix::PICSES, Ephemeris::Zodiac::PositionMatrix::TAURUS, Ephemeris::Zodiac::PositionMatrix::VIRGO, Ephemeris::Zodiac::PositionMatrix::CAPRICORN ]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module Ephemeris
2
+ module Planet
3
+ class Mercury
4
+ include Ephemeris::Zodiac::Dignity
5
+ ORB = 7
6
+
7
+ attr_accessor :position
8
+
9
+ def initialize( position )
10
+ self.position = position
11
+ end
12
+
13
+ def domicile
14
+ [ Ephemeris::Zodiac::PositionMatrix::GEMINI, Ephemeris::Zodiac::PositionMatrix::VIRGO ]
15
+ end
16
+
17
+ def detriment
18
+ [ Ephemeris::Zodiac::PositionMatrix::SAGITTARIUS, Ephemeris::Zodiac::PositionMatrix::PICSES ]
19
+ end
20
+
21
+ def exaltation
22
+ Ephemeris::Zodiac::PositionMatrix::VIRGO
23
+ end
24
+
25
+ def fall
26
+ Ephemeris::Zodiac::PositionMatrix::PISCES
27
+ end
28
+
29
+ def triplicity
30
+ [ Ephemeris::Zodiac::PositionMatrix::GEMINI, Ephemeris::Zodiac::PositionMatrix::LIBRA, Ephemeris::Zodiac::PositionMatrix::AQUARIUS ]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module Ephemeris
2
+ module Planet
3
+ class Moon
4
+ include Ephemeris::Zodiac::Dignity
5
+ ORB = 12
6
+
7
+ attr_accessor :position
8
+
9
+ def initialize( position )
10
+ self.position = position
11
+ end
12
+
13
+ def domicile
14
+ Ephemeris::Zodiac::PositionMatrix::CANCER
15
+ end
16
+
17
+ def detriment
18
+ Ephemeris::Zodiac::PositionMatrix::CAPRICORN
19
+ end
20
+
21
+ def exaltation
22
+ Ephemeris::Zodiac::PositionMatrix::TAURUS
23
+ end
24
+
25
+ def fall
26
+ Ephemeris::Zodiac::PositionMatrix::SCORPIO
27
+ end
28
+
29
+ def triplicity
30
+ [ Ephemeris::Zodiac::PositionMatrix::TAURUS, Ephemeris::Zodiac::PositionMatrix::VIRGO, Ephemeris::Zodiac::PositionMatrix::CAPRICORN, Ephemeris::Zodiac::PositionMatrix::CANCER, Ephemeris::Zodiac::PositionMatrix::SCORPIO, Ephemeris::Zodiac::PositionMatrix::PICSES ]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ require "ephemeris/planet/jupiter"
2
+ require "ephemeris/planet/mars"
3
+ require "ephemeris/planet/mercury"
4
+ require "ephemeris/planet/moon"
5
+ require "ephemeris/planet/saturn"
6
+ require "ephemeris/planet/sun"
7
+ require "ephemeris/planet/venus"
8
+
9
+ module Ephemeris::Planet
10
+ end
@@ -0,0 +1,34 @@
1
+ module Ephemeris
2
+ module Planet
3
+ class Saturn
4
+ include Ephemeris::Zodiac::Dignity
5
+ ORB = 9
6
+
7
+ attr_accessor :position
8
+
9
+ def initialize( position )
10
+ self.position = position
11
+ end
12
+
13
+ def domicile
14
+ [ Ephemeris::Zodiac::PositionMatrix::CAPRICORN, Ephemeris::Zodiac::PositionMatrix::AQUARIUS ]
15
+ end
16
+
17
+ def detriment
18
+ [ Ephemeris::Zodiac::PositionMatrix::CANCER, Ephemeris::Zodiac::PositionMatrix::LEO ]
19
+ end
20
+
21
+ def exaltation
22
+ Ephemeris::Zodiac::PositionMatrix::LIBRA
23
+ end
24
+
25
+ def fall
26
+ Ephemeris::Zodiac::PositionMatrix::ARIES
27
+ end
28
+
29
+ def triplicity
30
+ [ Ephemeris::Zodiac::PositionMatrix::GEMINI, Ephemeris::Zodiac::PositionMatrix::LIBRA, Ephemeris::Zodiac::PositionMatrix::AQUARIUS, Ephemeris::Zodiac::PositionMatrix::ARIES, Ephemeris::Zodiac::PositionMatrix::LEO, Ephemeris::Zodiac::PositionMatrix::SAGITTARIUS]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module Ephemeris
2
+ module Planet
3
+ class Sun
4
+ include Ephemeris::Zodiac::Dignity
5
+ ORB = 15
6
+
7
+ attr_accessor :position
8
+
9
+ def initialize( position )
10
+ self.position = position
11
+ end
12
+
13
+ def domicile
14
+ Zodiac::PositionMatrix::LEO
15
+ end
16
+
17
+ def detriment
18
+ Zodiac::PositionMatrix::AQUARIUS
19
+ end
20
+
21
+ def exaltation
22
+ Zodiac::PositionMatrix::ARIES
23
+ end
24
+
25
+ def fall
26
+ Zodiac::PositionMatrix::LIBRA
27
+ end
28
+
29
+ def triplicity
30
+ [ Ephemeris::Zodiac::PositionMatrix::ARIES, Ephemeris::Zodiac::PositionMatrix::LEO, Ephemeris::Zodiac::PositionMatrix::SAGITTARIUS ]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module Ephemeris
2
+ module Planet
3
+ class Venus
4
+ include Ephemeris::Zodiac::Dignity
5
+ ORB = 7
6
+
7
+ attr_accessor :position
8
+
9
+ def initialize( position )
10
+ self.position = position
11
+ end
12
+
13
+ def domicile
14
+ [ Ephemeris::Zodiac::PositionMatrix::TAURUS, Ephemeris::Zodiac::PositionMatrix::LIBRA ]
15
+ end
16
+
17
+ def detriment
18
+ [ Ephemeris::Zodiac::PositionMatrix::ARIES, Ephemeris::Zodiac::PositionMatrix::SCORPIO ]
19
+ end
20
+
21
+ def exaltation
22
+ Ephemeris::Zodiac::PositionMatrix::PISCES
23
+ end
24
+
25
+ def fall
26
+ Ephemeris::Zodiac::PositionMatrix::VIRGO
27
+ end
28
+
29
+ def triplicity
30
+ [ Ephemeris::Zodiac::PositionMatrix::CANCER, Ephemeris::Zodiac::PositionMatrix::SCORPIO, Ephemeris::Zodiac::PositionMatrix::PICSES, Ephemeris::Zodiac::PositionMatrix::TAURUS, Ephemeris::Zodiac::PositionMatrix::VIRGO, Ephemeris::Zodiac::PositionMatrix::CAPRICORN ]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ module Ephemeris
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,120 @@
1
+ module Ephemeris::Zodiac
2
+ module Aspect
3
+ def self.orb_range_defined_by_target( planet_1, planet_2 )
4
+ coverage = (planet_1.class::ORB + planet_2.class::ORB).to_f / 2
5
+ point = planet_2.position
6
+
7
+ if point < coverage or point+coverage > 360
8
+ return self.orb_range_by_target_at_aries_pisces( planet_1, planet_2, coverage)
9
+ else
10
+ return Ephemeris::Zodiac::Orb.new( (point - coverage)..(point + coverage), planet_1 )
11
+ end
12
+ end
13
+
14
+ def self.orb_range_by_target_at_aries_pisces( planet_1, planet_2, coverage)
15
+ # Try it the other way around
16
+ point = planet_1.position
17
+
18
+ if point < coverage or point+coverage > 360
19
+ # Ok, now for the hard part
20
+ if point < coverage
21
+ # Aries with a lower Pisces
22
+ pisces_range = [340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359]
23
+ difference = (point - coverage).round
24
+ pisces_range = pisces_range[ difference ]...360
25
+ return Ephemeris::Zodiac::Orb.new( [ pisces_range, 0..point+coverage], planet_2 )
26
+ else
27
+ # Pisces side upper Aries
28
+ difference = point + coverage - 360
29
+ return Ephemeris::Zodiac::Orb.new( [point-coverage...360, 0...difference], planet_2 )
30
+ end
31
+ else
32
+ return Ephemeris::Zodiac::Orb.new( (point - coverage)..(point + coverage), planet_2 )
33
+ end
34
+ end
35
+
36
+ module Conjunction
37
+ def self.conjoined?( planet_1, planet_2 )
38
+ orb = Ephemeris::Zodiac::Aspect.orb_range_defined_by_target( planet_1, planet_2 )
39
+ orb.cover?( [0] )
40
+ end
41
+ end
42
+
43
+ module Opposition
44
+ def self.opposed?( planet_1, planet_2 )
45
+ orb = Ephemeris::Zodiac::Aspect.orb_range_defined_by_target( planet_1, planet_2 )
46
+ calc = self.build_appropriate_motion_from_position( orb.target.position )
47
+
48
+ orb.cover?( calc )
49
+ end
50
+
51
+ def self.build_appropriate_motion_from_position( position )
52
+ return [ -180 ] if ( position >= 180 )
53
+ return [ 180 ] if ( position < 180 )
54
+ end
55
+ end
56
+
57
+ module Square
58
+ def self.square?(planet_1, planet_2)
59
+ orb = Ephemeris::Zodiac::Aspect.orb_range_defined_by_target( planet_1, planet_2 )
60
+ calc = self.build_appropriate_motion_from_position( orb.target.position )
61
+
62
+ orb.cover?( calc ) #already an array
63
+ end
64
+
65
+ def self.build_appropriate_motion_from_position( position )
66
+ if (0...90).cover? position
67
+ return [ 90, 270 ]
68
+ elsif (90...270).cover? position
69
+ return [ -90, 90 ]
70
+ elsif (270...360).cover? position
71
+ return [ -90, -270 ]
72
+ else
73
+ raise StandardError.new("There are only 360 degress in a circle, buddy.")
74
+ end
75
+ end
76
+ end
77
+
78
+ module Trine
79
+ def self.trine?( planet_1, planet_2 )
80
+ orb = Ephemeris::Zodiac::Aspect.orb_range_defined_by_target( planet_1, planet_2 )
81
+ calc = self.build_appropriate_motion_from_position( orb.target.position )
82
+
83
+ orb.cover?( calc ) # already an array
84
+ end
85
+
86
+ def self.build_appropriate_motion_from_position( position )
87
+ if (0...120).cover? position
88
+ return [ 120, 240 ]
89
+ elsif (120...240).cover? position
90
+ return [ 120, -120 ]
91
+ elsif (240...360).cover? position
92
+ return [ -120, -240 ]
93
+ else
94
+ raise StandardError.new("There are only 360 degress in a circle, buddy.")
95
+ end
96
+ end
97
+ end
98
+
99
+ module Sextile
100
+ def self.sextile?( planet_1, planet_2 )
101
+ orb = Ephemeris::Zodiac::Aspect.orb_range_defined_by_target( planet_1, planet_2 )
102
+ calc = self.build_appropriate_motion_from_position( orb.target.position )
103
+
104
+ orb.cover?( calc ) # already an array
105
+ end
106
+
107
+ def self.build_appropriate_motion_from_position( position )
108
+ if (0...60).cover? position
109
+ return [ 60, 300 ]
110
+ elsif (60...300).cover? position
111
+ return [ -60, 60 ]
112
+ elsif (240...360).cover? position
113
+ return [ -60, -300 ]
114
+ else
115
+ raise StandardError.new("There are only 360 degress in a circle, buddy.")
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,28 @@
1
+ module Ephemeris
2
+ module Zodiac
3
+ module Dignity
4
+ ['exaltation', 'fall'].each do |method|
5
+ define_method "#{method}?".to_sym do
6
+ self.send( method.to_sym ).cover? @position
7
+ end
8
+ end
9
+
10
+ ['domicile', 'detriment', 'triplicity'].each do |method|
11
+ define_method "#{method}?".to_sym do
12
+ range = self.send( method.to_sym )
13
+ result = false
14
+
15
+ if range.is_a? Range
16
+ return range.cover? @position
17
+ else
18
+ range.each do |dignity|
19
+ result = true if dignity.cover? @position
20
+ end
21
+
22
+ return result
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,21 @@
1
+ module Ephemeris
2
+ module Zodiac
3
+ class Interpreter
4
+ attr_accessor :sign
5
+
6
+ def initialize( degree )
7
+ @sign = nil
8
+
9
+ raise Ephemeris::Zodiac::InvalidDegree.new("#{degree} is not between 0 and 360.") unless (0...360).cover? degree
10
+
11
+ signs = Ephemeris::Zodiac::PositionMatrix.constants
12
+
13
+ signs.each do |sign|
14
+ @sign = sign.to_s if Ephemeris::Zodiac::PositionMatrix.const_get(sign).cover?( degree )
15
+ end
16
+
17
+ raise Ephemeris::Zodiac::UnprocessableEntity.new("Your request #{degree} was not found") if @sign.nil?
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,28 @@
1
+ module Ephemeris::Zodiac
2
+ class Orb
3
+ attr_accessor :range, :target
4
+
5
+ def initialize(range, target)
6
+ @range, @target = range, target
7
+ end
8
+
9
+ def cover?( degrees_difference )
10
+ cover = false
11
+
12
+ if @range.is_a? Range
13
+ degrees_difference.each do |degrees|
14
+ cover = true if @range.cover?( @target.position + degrees )
15
+ end
16
+ elsif @range.is_a? Array
17
+ @range.each do |part|
18
+ degrees_difference.each do |degrees|
19
+ cover = true if part.cover?( @target.position + degrees )
20
+ end
21
+ end
22
+ end
23
+
24
+ return cover
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,18 @@
1
+ module Ephemeris
2
+ module Zodiac
3
+ module PositionMatrix
4
+ ARIES = (0...30)
5
+ TAURUS = (30...60)
6
+ GEMINI = (60...90)
7
+ CANCER = (90...120)
8
+ LEO = (120...150)
9
+ VIRGO = (150...180)
10
+ LIBRA = (180...210)
11
+ SCORPIO = (210...240)
12
+ SAGITTARIUS = (240...270)
13
+ CAPRICORN = (270...300)
14
+ AQUARIUS = (300...330)
15
+ PISCES = (330...360)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ require "ephemeris/zodiac/aspect"
2
+ require "ephemeris/zodiac/interpreter"
3
+ require "ephemeris/zodiac/position_matrix"
4
+ require "ephemeris/zodiac/dignity"
5
+ require "ephemeris/zodiac/orb"
6
+
7
+ module Ephemeris
8
+ module Zodiac
9
+ class InvalidDegree < StandardError; end
10
+ class UnprocessableEntity < StandardError; end
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ephemeris
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - T. Orval Nielsen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-03-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.10.4
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.10.4
69
+ - !ruby/object:Gem::Dependency
70
+ name: swe4r
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.2
83
+ description:
84
+ email:
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - ".gitignore"
90
+ - ".rspec"
91
+ - Gemfile
92
+ - LICENSE.txt
93
+ - README.md
94
+ - Rakefile
95
+ - bin/console
96
+ - bin/setup
97
+ - ephemeris.gemspec
98
+ - lib/ephemeris.rb
99
+ - lib/ephemeris/planet/jupiter.rb
100
+ - lib/ephemeris/planet/mars.rb
101
+ - lib/ephemeris/planet/mercury.rb
102
+ - lib/ephemeris/planet/moon.rb
103
+ - lib/ephemeris/planet/planet.rb
104
+ - lib/ephemeris/planet/saturn.rb
105
+ - lib/ephemeris/planet/sun.rb
106
+ - lib/ephemeris/planet/venus.rb
107
+ - lib/ephemeris/version.rb
108
+ - lib/ephemeris/zodiac/aspect.rb
109
+ - lib/ephemeris/zodiac/dignity.rb
110
+ - lib/ephemeris/zodiac/interpreter.rb
111
+ - lib/ephemeris/zodiac/orb.rb
112
+ - lib/ephemeris/zodiac/position_matrix.rb
113
+ - lib/ephemeris/zodiac/zodiac.rb
114
+ homepage:
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.5.1
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Ephemeris provides dignity and relationship calculations around the existing
138
+ `swe4r` binding to the open source Swiss Ephemeris.
139
+ test_files: []