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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78645b3474126de624520769e3e47a912c74c8ec
4
- data.tar.gz: 912c342c8937cf8d955276d755a7ef2d8e215d9a
3
+ metadata.gz: 1362ed73c8432a4d47876d69af1d926045cc8650
4
+ data.tar.gz: 9de3d7f372a01012cdd48a9b4f5612da0a0be8ad
5
5
  SHA512:
6
- metadata.gz: 57e2114c946ee6c2f1fd26df0ad418f4abee99535f63674b15de6ec1af1ad6ae1437b44401a874687f135892d91356d9d4a5231efc23f88cad71c0f9dc71649d
7
- data.tar.gz: 2552ad29a97eddf67c6b90b3a9050e691ae3c13a58a7fb7668937d66b15d5566a960240c565064714cba88dd778e069c4820493facea0b6da251c0b04fb802eb
6
+ metadata.gz: 4e490f441c1323f48dc42dd7031590285fd88c0353eca35839f1de9637fceeeef5c28ae470227a22bec368d3b2e61dd3b77606652cd29ca9f0765349e58d4a33
7
+ data.tar.gz: ece9f1a0bf6fc7c539f6777aa62cdc849d76aae33c52f9c150dc00501620a8af177e4c8f448caad925c002986bf59c67845fcaad506e31b2dd60d71fad0dc668
@@ -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
- ]
@@ -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
- attributes.each do |attribute, value|
61
- if SVGPlot::SVG_TRANSFORM.include? attribute
62
- transforms[attribute] = value
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
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'svgplot'
3
- s.version = '0.0.3'
3
+ s.version = '0.1.1'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
 
6
6
  s.summary = 'SVG Generation Library'
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.0.3
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-04 00:00:00.000000000 Z
14
+ date: 2015-01-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rubocop