svgle 0.1.0 → 0.1.1

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: 7aaac0d75a831fb3552d93092087d2e2bcf51c57
4
- data.tar.gz: 10d92c3640d96d8a5e97eb00ba7de32ed895c2c8
3
+ metadata.gz: 0d6115fe65ecf261d93876cdb92cdfd2d4df4d7f
4
+ data.tar.gz: 5c0f8fd33ece472364359b30a798bf24cc9483bd
5
5
  SHA512:
6
- metadata.gz: 13444cd92dc776b6a799745e8cd352e81280bdaa55f89a8fab0e8ba5caeaf6f2c7170d17bb0181348f7ffcf305bbc589672e50ec5b338109beaf9e028033cdeb
7
- data.tar.gz: ee392d0e8041980154cb63b8c9fd148116914c833f28a9c4ed16315a0e1e4c0e46a1e6e787e10961fe849a60497bcbc676448a05ad9deee81fc29c34c73171e8
6
+ metadata.gz: ad1d55fa76f6aa1a87450f55ec7ebf05a31661ede773a93ef8cb2050e780e01807a096a7a5569c352a28a4413d27d6a3fcc286bde33d7389978739f759d9f6e4
7
+ data.tar.gz: e77ff72a2a1104b1b2b56a46e3fe9139fdb9619083217044f6c00341325286457b082b295d66d0625f8bcac6437d0992262e20cae35826d476117427c122227c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -4,26 +4,78 @@
4
4
 
5
5
  require 'rexle'
6
6
 
7
+ # helpful SVG element references:
8
+ #
9
+ # * https://developer.mozilla.org/en-US/docs/Web/SVG/Element
10
+ # * http://www.w3schools.com/svg/svg_reference.asp
11
+
7
12
 
8
13
  class Svgle < Rexle
9
14
 
10
15
  class Element < Rexle::Element
16
+
17
+ def self.attr2_accessor(*a)
18
+
19
+ a << :id
20
+
21
+ a.each do |attribute|
22
+
23
+ class_eval do
24
+
25
+ define_method attribute.to_s.gsub('-','_').to_sym do
26
+ attributes[attribute]
27
+ end
28
+
29
+ define_method (attribute.to_s + '=').to_sym do |val|
30
+ attributes[attribute] = val
31
+ end
32
+
33
+ end
34
+ end
35
+ end
11
36
  end
37
+
38
+ class A < Element
39
+ # undecided how to implement this
40
+ # see http://stackoverflow.com/questions/12422668/getting-xlinkhref-attribute-of-the-svg-image-element-dynamically-using-js-i
41
+ #attr2_accessor *%i(href)
42
+ end
43
+
44
+ class Circle < Element
45
+ attr2_accessor *%i(cx cy r rx ry stroke stroke-width)
46
+ end
12
47
 
13
48
  class G < Element
49
+ attr2_accessor *%i(fill opacity)
14
50
  end
15
51
 
16
52
  class Line < Element
17
- def x1()
18
- attributes[:x1]
19
- end
20
- def x1=(v)
21
- attributes[:x1] = v
22
- end
53
+ attr2_accessor *%i(x1 y1 x2 y2)
54
+ end
55
+
56
+ class Path < Element
57
+ attr2_accessor *%i(d stroke stroke-width fill)
58
+ end
59
+
60
+ class Polygon < Element
61
+ attr2_accessor *%i(points)
23
62
  end
24
63
 
64
+ class Polyline < Element
65
+ attr2_accessor *%i(points)
66
+ end
67
+
68
+ class Rect < Element
69
+ attr2_accessor *%i(x y width height rx ry)
70
+ end
71
+
25
72
  class Svg < Element
73
+ attr2_accessor *%i(width height)
26
74
  end
75
+
76
+ class Text < Element
77
+ attr2_accessor *%i(x y fill)
78
+ end
27
79
 
28
80
 
29
81
  def scan_element(name, attributes=nil, *children)
@@ -69,4 +121,4 @@ class Svgle < Rexle
69
121
  return element
70
122
  end
71
123
 
72
- end
124
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svgle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -32,7 +32,27 @@ cert_chain:
32
32
  rUf4C1wr3bOSgQ==
33
33
  -----END CERTIFICATE-----
34
34
  date: 2015-11-22 00:00:00.000000000 Z
35
- dependencies: []
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: rexle
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.3'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.3.9
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.3'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.3.9
36
56
  description:
37
57
  email: james@r0bertson.co.uk
38
58
  executables: []
@@ -63,5 +83,7 @@ rubyforge_project:
63
83
  rubygems_version: 2.4.8
64
84
  signing_key:
65
85
  specification_version: 4
66
- summary: svgle
86
+ summary: "*Experimental gem under development.* Svgle (SVG + Rexle) generates an SVG
87
+ Document Object Model from the given SVG. Suitable for accessing, or modifying SVG
88
+ elements as objects."
67
89
  test_files: []
metadata.gz.sig CHANGED
Binary file