horoscope 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.coveralls.yml +2 -0
- data/Gemfile +3 -1
- data/README.md +5 -1
- data/lib/horoscope.rb +10 -0
- data/lib/horoscope/overrides/math_override.rb +0 -20
- data/lib/horoscope/version.rb +1 -1
- data/spec/horoscope_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- metadata +2 -1
data/.coveralls.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Calculate the accurate horoscope of a person using Vedic Horoscope technique giv
|
|
4
4
|
|
5
5
|
[![Travis CI ](https://api.travis-ci.org/bragboy/horoscope.png) ](https://travis-ci.org/bragboy/horoscope)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/bragboy/horoscope.png)](https://codeclimate.com/github/bragboy/horoscope)
|
7
|
+
[![Gemnasium ](https://gemnasium.com/bragboy/horoscope.png) ](https://gemnasium.com/bragboy/horoscope)
|
8
|
+
[![Coveralls ](https://coveralls.io/repos/bragboy/horoscope/badge.png)](https://coveralls.io/r/bragboy/horoscope)
|
7
9
|
|
8
10
|
## Installation
|
9
11
|
|
@@ -30,6 +32,8 @@ Then you can start using this by passing a Time object along with latitude and l
|
|
30
32
|
=> {"As"=>4, "Su"=>0, "Mo"=>8, "Ma"=>9, "Me"=>11, "Ju"=>9, "Ve"=>0, "Sa"=>1, "Ra"=>8, "Ke"=>2}
|
31
33
|
|
32
34
|
h.create_chart #This will generate the horoscope chart to your working directory
|
35
|
+
|
36
|
+
![Sachin Tendulkar's horoscope](http://i.imgur.com/theTdBg.png)
|
33
37
|
|
34
38
|
## Contributing
|
35
39
|
|
@@ -42,4 +46,4 @@ Then you can start using this by passing a Time object along with latitude and l
|
|
42
46
|
|
43
47
|
## Future Development
|
44
48
|
|
45
|
-
|
49
|
+
Need to add North Indian Chart type. Also show more data like Birth Star, Dasha Directions etc., Follow this page for more updates
|
data/lib/horoscope.rb
CHANGED
@@ -14,6 +14,8 @@ module Horoscope
|
|
14
14
|
YBIAS = 15
|
15
15
|
PADDING = 15
|
16
16
|
|
17
|
+
CENTER_PADDING = 40
|
18
|
+
|
17
19
|
ERRORS = {
|
18
20
|
:Date => "Error: Invalid Date. Enter a valid date between years 1600 AD and 2300 AD",
|
19
21
|
:Zone => "Error: Please pass a valid time zone ranging from -12.0 to +12.0",
|
@@ -95,6 +97,14 @@ module Horoscope
|
|
95
97
|
end
|
96
98
|
end
|
97
99
|
end
|
100
|
+
|
101
|
+
text.gravity = Magick::CenterGravity
|
102
|
+
text.pointsize = 18
|
103
|
+
text.fill = 'black'
|
104
|
+
text.annotate(canvas, 0, 0, 0, -CENTER_PADDING, @datetime.strftime('%d %b %Y'))
|
105
|
+
text.annotate(canvas, 0, 0, 0, 0, @datetime.strftime('%I:%M %p'))
|
106
|
+
text.annotate(canvas, 0, 0, 0, CENTER_PADDING, "Lat: #{@lat.round(1)}, Lon: #{@lon.round(1)}")
|
107
|
+
|
98
108
|
x = canvas.write('output.png')
|
99
109
|
end
|
100
110
|
|
@@ -1,21 +1,5 @@
|
|
1
1
|
# Equivalent Java methods overriden for Ruby
|
2
2
|
module Math
|
3
|
-
def self.IEEEremainder(x, y)
|
4
|
-
begin
|
5
|
-
regularMod = Math.java_mod(x,y) #DO NOT use Ruby Mod operator here as -1%13 yields different results for Java and Ruby
|
6
|
-
return 0.0 if (regularMod == 0)
|
7
|
-
alternativeResult = regularMod - (y.abs * Math.signum(x))
|
8
|
-
if alternativeResult.abs == regularMod.abs
|
9
|
-
divisionResult = x/y
|
10
|
-
roundedResult = divisionResult.round
|
11
|
-
return roundedResult.abs > divisionResult.abs ? alternativeResult : regularMod
|
12
|
-
end
|
13
|
-
return alternativeResult.abs < regularMod.abs ? alternativeResult : regularMod
|
14
|
-
rescue ZeroDivisionError
|
15
|
-
return 0.0/0.0 #NaN
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
3
|
def self.toRadians(angdeg)
|
20
4
|
angdeg / 180.0 * Math::PI
|
21
5
|
end
|
@@ -24,10 +8,6 @@ module Math
|
|
24
8
|
angrad * 180.0 / Math::PI
|
25
9
|
end
|
26
10
|
|
27
|
-
def self.signum(num)
|
28
|
-
num > 0 ? 1 : (num == 0? 0 : -1)
|
29
|
-
end
|
30
|
-
|
31
11
|
def self.java_mod(x,y)
|
32
12
|
return 0 if x == 0 && y != 0
|
33
13
|
return x%y if (x > 0 && y > 0) || (x<0 && y<0)
|
data/lib/horoscope/version.rb
CHANGED
data/spec/horoscope_spec.rb
CHANGED
@@ -69,7 +69,7 @@ describe Horoscope do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it "can generate chart" do
|
72
|
-
h = Horoscope::Horo.new(:datetime => Time.
|
72
|
+
h = Horoscope::Horo.new(:datetime => Time.utc(1973, 4, 24, 14, 25), :zone => 5.5, :lat => 18.60, :lon => -72.50)
|
73
73
|
h.compute
|
74
74
|
h.create_chart
|
75
75
|
expect(File).to exist("output.png")
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: horoscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -66,6 +66,7 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
+
- .coveralls.yml
|
69
70
|
- .gitignore
|
70
71
|
- .rspec
|
71
72
|
- .travis.yml
|