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 +4 -4
- data/lib/astro_calc/moon_phases.rb +27 -3
- data/lib/astro_calc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 158a1de9098c7314541ea33b827793fe5e5aac17
|
4
|
+
data.tar.gz: 407ab02eb772c843c5a2cdcb1749665d123b9267
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
113
|
-
|
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
|
data/lib/astro_calc/version.rb
CHANGED