svgplot 0.0.3 → 0.1.1
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.
- checksums.yaml +4 -4
- data/lib/svgplot/meta.rb +0 -13
- data/lib/svgplot/plot.rb +14 -16
- data/svgplot.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1362ed73c8432a4d47876d69af1d926045cc8650
|
|
4
|
+
data.tar.gz: 9de3d7f372a01012cdd48a9b4f5612da0a0be8ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4e490f441c1323f48dc42dd7031590285fd88c0353eca35839f1de9637fceeeef5c28ae470227a22bec368d3b2e61dd3b77606652cd29ca9f0765349e58d4a33
|
|
7
|
+
data.tar.gz: ece9f1a0bf6fc7c539f6777aa62cdc849d76aae33c52f9c150dc00501620a8af177e4c8f448caad925c002986bf59c67845fcaad506e31b2dd60d71fad0dc668
|
data/lib/svgplot/meta.rb
CHANGED
|
@@ -50,16 +50,3 @@ SVGPlot::SVG_TRANSFORM = [
|
|
|
50
50
|
:skewX, # angle
|
|
51
51
|
:skewY # angle
|
|
52
52
|
]
|
|
53
|
-
|
|
54
|
-
SVGPlot::CSS_STYLE = [
|
|
55
|
-
:fill,
|
|
56
|
-
:stroke_width,
|
|
57
|
-
:stroke,
|
|
58
|
-
:fill_opacity,
|
|
59
|
-
:stroke_opacity,
|
|
60
|
-
:opacity,
|
|
61
|
-
:'text-align',
|
|
62
|
-
:font,
|
|
63
|
-
:'white-space',
|
|
64
|
-
:display
|
|
65
|
-
]
|
data/lib/svgplot/plot.rb
CHANGED
|
@@ -54,33 +54,31 @@ module SVGPlot
|
|
|
54
54
|
|
|
55
55
|
def validate_attributes(attributes)
|
|
56
56
|
clean_attributes = {}
|
|
57
|
-
transforms = {}
|
|
58
|
-
styles = {}
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
elsif SVGPlot::CSS_STYLE.include? attribute
|
|
64
|
-
styles[attribute] = value
|
|
65
|
-
elsif attribute.match(/^data-[a-z]+$/)
|
|
66
|
-
clean_attributes[attribute] = value
|
|
67
|
-
else
|
|
68
|
-
clean_attributes[validate_attribute(attribute)] = value
|
|
69
|
-
end
|
|
58
|
+
transforms = {}
|
|
59
|
+
attributes.delete(:transform) { Hash.new }.each do |key, value|
|
|
60
|
+
transforms[key] = value
|
|
70
61
|
end
|
|
71
|
-
|
|
72
|
-
#always prefer more verbose definition.
|
|
73
62
|
unless transforms.empty?
|
|
74
|
-
transforms.merge!(clean_attributes[:transform]) if clean_attributes[:transform]
|
|
75
63
|
str = ""
|
|
76
64
|
write_transforms(transforms, str)
|
|
77
65
|
clean_attributes[validate_attribute(:transform)] = str
|
|
78
66
|
end
|
|
79
67
|
|
|
68
|
+
styles = {}
|
|
69
|
+
attributes.delete(:style) { Hash.new }.each { |k, v| styles[k] = v }
|
|
80
70
|
unless styles.empty?
|
|
81
|
-
styles.merge!(clean_attributes[:style]) if clean_attributes[:style]
|
|
82
71
|
clean_attributes[validate_attribute(:style)] = styles
|
|
83
72
|
end
|
|
73
|
+
|
|
74
|
+
attributes.delete(:data) { Hash.new }.each do |key, value|
|
|
75
|
+
clean_attributes["data-#{key.to_s}".to_sym] = value
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
attributes.each do |key, value|
|
|
79
|
+
clean_attributes[validate_attribute(key)] = value
|
|
80
|
+
end
|
|
81
|
+
|
|
84
82
|
clean_attributes
|
|
85
83
|
end
|
|
86
84
|
|
data/svgplot.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: svgplot
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Les Aker
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2015-01-
|
|
14
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: rubocop
|