svg 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/svg.rb +39 -2
- metadata +4 -4
data/lib/svg.rb
CHANGED
@@ -25,11 +25,12 @@ module Svg
|
|
25
25
|
end
|
26
26
|
|
27
27
|
class Style < String
|
28
|
-
attr_accessor :fill, :stroke, :stroke_width, :fill_opacity, :stroke_opacity
|
28
|
+
attr_accessor :fill, :stroke, :stroke_width, :opacity, :fill_opacity, :stroke_opacity
|
29
29
|
def to_s
|
30
30
|
string_val = attr_to_s 'fill', fill
|
31
31
|
string_val += attr_to_s 'stroke', stroke
|
32
32
|
string_val += attr_to_s 'stroke-width', stroke_width
|
33
|
+
string_val += attr_to_s 'opacity', opacity
|
33
34
|
string_val += attr_to_s 'fill-opacity', fill_opacity
|
34
35
|
string_val += attr_to_s 'stroke-opacity', stroke_opacity
|
35
36
|
if not string_val.empty?
|
@@ -78,11 +79,13 @@ module Svg
|
|
78
79
|
end
|
79
80
|
|
80
81
|
class Rectangle<Feature
|
81
|
-
attr_accessor :top_x, :top_y, :width, :height
|
82
|
+
attr_accessor :top_x, :top_y, :radius_x, :radius_y, :width, :height
|
82
83
|
def to_svg
|
83
84
|
string_val = "<rect"
|
84
85
|
string_val += attr_to_s 'x', top_x
|
85
86
|
string_val += attr_to_s 'y', top_y
|
87
|
+
string_val += attr_to_s 'rx', radius_x
|
88
|
+
string_val += attr_to_s 'ry', radius_y
|
86
89
|
string_val += attr_to_s 'width', width
|
87
90
|
string_val += attr_to_s 'height', height
|
88
91
|
if not style.nil?
|
@@ -95,5 +98,39 @@ module Svg
|
|
95
98
|
|
96
99
|
end
|
97
100
|
|
101
|
+
class Ellipse<Feature
|
102
|
+
attr_accessor :center_x, :center_y, :radius_x, :radius_y
|
103
|
+
def to_svg
|
104
|
+
string_val = "<ellipse"
|
105
|
+
string_val += attr_to_s 'cx', center_x
|
106
|
+
string_val += attr_to_s 'cy', center_y
|
107
|
+
string_val += attr_to_s 'rx', radius_x
|
108
|
+
string_val += attr_to_s 'ry', radius_y
|
109
|
+
|
110
|
+
if not style.nil?
|
111
|
+
string_val += " style=\"#{style.to_s}\""
|
112
|
+
end
|
113
|
+
string_val += "/>"
|
114
|
+
|
115
|
+
return string_val
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
class Line<Feature
|
120
|
+
attr_accessor :from_x, :from_y, :to_x, :to_y
|
121
|
+
def to_svg
|
122
|
+
string_val = "<line"
|
123
|
+
string_val += attr_to_s 'x1', from_x
|
124
|
+
string_val += attr_to_s 'y1', from_y
|
125
|
+
string_val += attr_to_s 'x2', to_x
|
126
|
+
string_val += attr_to_s 'y2', to_y
|
98
127
|
|
128
|
+
if not style.nil?
|
129
|
+
string_val += " style=\"#{style.to_s}\""
|
130
|
+
end
|
131
|
+
string_val += "/>"
|
132
|
+
|
133
|
+
return string_val
|
134
|
+
end
|
135
|
+
end
|
99
136
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Intended to be a gem which will help to build complex Simple Vector Graphics
|
15
15
|
(SVG)
|
@@ -33,7 +33,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
33
33
|
version: '0'
|
34
34
|
segments:
|
35
35
|
- 0
|
36
|
-
hash: -
|
36
|
+
hash: -1558949162911032482
|
37
37
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
39
39
|
requirements:
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
segments:
|
44
44
|
- 0
|
45
|
-
hash: -
|
45
|
+
hash: -1558949162911032482
|
46
46
|
requirements: []
|
47
47
|
rubyforge_project:
|
48
48
|
rubygems_version: 1.8.24
|