astro_calc 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47e8093638e9059b74669fe2363e1bac25c3ec44
4
- data.tar.gz: 76c5ec6f48d04f7b50aa1248a8cb90ffbcc85aeb
3
+ metadata.gz: 158a1de9098c7314541ea33b827793fe5e5aac17
4
+ data.tar.gz: 407ab02eb772c843c5a2cdcb1749665d123b9267
5
5
  SHA512:
6
- metadata.gz: aa6a4ef0cd65e01fba653da89b264a6d0d5c1c601f962b55efbafd77fc2c28f23041d7d005e8e4f9288d26fc7b06e2a3135d2a852b374e82d3ccda082af188f4
7
- data.tar.gz: 5a9febde82d9a78948ddacf52bbd5a3cae873d7130c2a319a70699013c833bdfaa4b228ce8bad2684ae4b022ba6fc28edd9cb0e1416116b5ec3a9c1de747fa06
6
+ metadata.gz: f214f2bd4ea5c40943347020f749a7692723d9bee3e7b9fc601009569104da20801738d32a97f2d434aa9329ef325f75e41406e6d63e76cf221409eadb26af18
7
+ data.tar.gz: 208abecc4d7575e53b042337f537029ee54ad00810d64e407079da382ad17989f93873fcab259d03fe7e355a1983ad0e248f1f9800bcb9b05e2af35030ef2668
@@ -108,9 +108,33 @@ class MoonPhase
108
108
  end
109
109
  end
110
110
 
111
- def svg
112
- output = "<path d='m100,0 a20,20 0 1,1 0,150 a20,20 0 1,1 0,-150' class='moonback'></path>"
113
- output << "<path d='m100,0 a#{@magnitude.round(2)},20 0 1,#{@sweep[0]} 0,150 a20,20 0 1,#{@sweep[1]} 0,-150' class='moon'></path>"
111
+ def svg(options = {})
112
+ default_options = {
113
+ include_style: true,
114
+ height: 200,
115
+ background_color: "#111111",
116
+ left: 75,
117
+ top: 75,
118
+ moon_color: "#CDCDCD",
119
+ shadow_color: "#000000"
120
+ }
121
+ options = default_options.merge(options)
122
+
123
+ output = ""
124
+
125
+ if options[include_style] then
126
+ output << "<style>"
127
+ output << "#moonholder { height: #{options[height]}px; background-color: #{options[background_color]}; }"
128
+ output << "#moon { position:absolute; left:#{options[left]}px; top:#{options[top]}px; }"
129
+ output << ".moon { fill: #{options[moon_color]}; }"
130
+ output << ".moonback { stroke: #{options[shadow_color]}; stroke-width: 1px; height: 180px; }"
131
+ output << "</style>"
132
+ end
133
+
134
+ output << "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100% 100%' version='1.1' id='moon'>"
135
+ output << " <path d='m100,0 a20,20 0 1,1 0,150 a20,20 0 1,1 0,-150' class='moonback'></path>"
136
+ output << " <path d='m100,0 a#{@magnitude.round(2)},20 0 1,#{@sweep[0]} 0,150 a20,20 0 1,#{@sweep[1]} 0,-150' class='moon'></path>"
137
+ output << "</svg>"
114
138
  output.html_safe
115
139
  end
116
140
  end
@@ -1,3 +1,3 @@
1
1
  module AstroCalc
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astro_calc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reuben Mallaby