savage 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/savage/sub_path.rb +11 -11
- data/lib/savage/utils.rb +1 -7
- data/lib/savage.rb +2 -1
- data/savage.gemspec +18 -15
- metadata +53 -19
data/README.rdoc
CHANGED
@@ -25,7 +25,7 @@ What if you want to roll your own from the get-go? No problem:
|
|
25
25
|
p.close_path
|
26
26
|
end
|
27
27
|
|
28
|
-
We'll learn more about the actual drawing methods here shortly, but suffice it to say they are provided both as methods on the constructor block parameter for the sake of your visual organization, and the path itself after
|
28
|
+
We'll learn more about the actual drawing methods here shortly, but suffice it to say they are provided both as methods on the constructor block parameter for the sake of your visual organization, and the path itself after instantiation, as below:
|
29
29
|
|
30
30
|
path = Savage::Path.new
|
31
31
|
path.move_to 100, 200
|
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/therubyneck/savage"
|
12
12
|
gem.authors = ["Jeremy Holland"]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
gem.add_dependency "activesupport", ">= 2.3.5"
|
14
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/savage/sub_path.rb
CHANGED
@@ -2,34 +2,34 @@ module Savage
|
|
2
2
|
class SubPath
|
3
3
|
include Utils
|
4
4
|
include DirectionProxy
|
5
|
-
|
5
|
+
|
6
6
|
define_proxies do |sym,const|
|
7
7
|
define_method(sym) do |*args|
|
8
8
|
raise TypeError if const == "QuadraticCurveTo" && @directions.last.class != Directions::QuadraticCurveTo && [2,3].include?(args.length)
|
9
9
|
raise TypeError if const == "CubicCurveTo" && @directions.last.class != Directions::CubicCurveTo && [4,5].include?(args.length)
|
10
|
-
(@directions <<
|
11
|
-
end
|
10
|
+
(@directions << ("Savage::Directions::" << const).constantize.new(*args)).last
|
11
|
+
end
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
attr_accessor :directions
|
15
|
-
|
15
|
+
|
16
16
|
def move_to(*args)
|
17
17
|
return nil unless @directions.empty?
|
18
18
|
(@directions << Directions::MoveTo.new(*args)).last
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def initialize(*args)
|
22
22
|
@directions = []
|
23
23
|
move_to(*args) if (2..3).include?(args.length)
|
24
24
|
yield self if block_given?
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def to_command
|
28
28
|
@directions.to_enum(:each_with_index).collect { |dir, i|
|
29
29
|
command_string = dir.to_command
|
30
30
|
if i > 0
|
31
31
|
prev_command_code = @directions[i-1].command_code
|
32
|
-
if dir.command_code == prev_command_code || (prev_command_code.match(/^[Mm]$/) && dir.command_code == 'L')
|
32
|
+
if dir.command_code == prev_command_code || (prev_command_code.match(/^[Mm]$/) && dir.command_code == 'L')
|
33
33
|
command_string.gsub!(/^[A-Za-z]/,'')
|
34
34
|
command_string.insert(0,' ') unless command_string.match(/^-/)
|
35
35
|
end
|
@@ -37,13 +37,13 @@ module Savage
|
|
37
37
|
command_string
|
38
38
|
}.join
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
41
|
def commands
|
42
42
|
@directions
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def closed?
|
46
46
|
@directions.last.kind_of? Directions::ClosePath
|
47
47
|
end
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
data/lib/savage/utils.rb
CHANGED
@@ -3,11 +3,5 @@ module Savage
|
|
3
3
|
def bool_to_int(value)
|
4
4
|
(value) ? 1 : 0
|
5
5
|
end
|
6
|
-
def constantize(string)
|
7
|
-
unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ string
|
8
|
-
raise NameError, "#{string.inspect} is not a valid constant name!"
|
9
|
-
end
|
10
|
-
Object.module_eval("::#{$1}", __FILE__, __LINE__)
|
11
|
-
end
|
12
6
|
end
|
13
|
-
end
|
7
|
+
end
|
data/lib/savage.rb
CHANGED
data/savage.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{savage}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeremy Holland"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-08-26}
|
13
13
|
s.description = %q{A little gem for extracting and manipulating SVG vector path data.}
|
14
14
|
s.email = %q{jeremy@jeremypholland.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -64,40 +64,43 @@ Gem::Specification.new do |s|
|
|
64
64
|
s.homepage = %q{http://github.com/therubyneck/savage}
|
65
65
|
s.rdoc_options = ["--charset=UTF-8"]
|
66
66
|
s.require_paths = ["lib"]
|
67
|
-
s.rubygems_version = %q{1.3.
|
67
|
+
s.rubygems_version = %q{1.3.7}
|
68
68
|
s.summary = %q{A little library to manipulate SVG path data}
|
69
69
|
s.test_files = [
|
70
|
-
"spec/
|
71
|
-
"spec/savage/directions/
|
72
|
-
"spec/savage/directions/cubic_curve_to_spec.rb",
|
73
|
-
"spec/savage/directions/horizontal_to_spec.rb",
|
70
|
+
"spec/savage_spec.rb",
|
71
|
+
"spec/savage/directions/point_spec.rb",
|
74
72
|
"spec/savage/directions/line_to_spec.rb",
|
75
73
|
"spec/savage/directions/move_to_spec.rb",
|
76
|
-
"spec/savage/directions/point_spec.rb",
|
77
74
|
"spec/savage/directions/quadratic_curve_spec.rb",
|
75
|
+
"spec/savage/directions/cubic_curve_to_spec.rb",
|
76
|
+
"spec/savage/directions/arc_to_spec.rb",
|
78
77
|
"spec/savage/directions/vertical_to_spec.rb",
|
78
|
+
"spec/savage/directions/close_path_spec.rb",
|
79
|
+
"spec/savage/directions/horizontal_to_spec.rb",
|
80
|
+
"spec/savage/sub_path_spec.rb",
|
79
81
|
"spec/savage/parser_spec.rb",
|
80
82
|
"spec/savage/path_spec.rb",
|
81
|
-
"spec/
|
82
|
-
"spec/savage_spec.rb",
|
83
|
-
"spec/shared/command.rb",
|
84
|
-
"spec/shared/coordinate_target.rb",
|
85
|
-
"spec/shared/direction.rb",
|
83
|
+
"spec/spec_helper.rb",
|
86
84
|
"spec/shared/point_target.rb",
|
87
|
-
"spec/
|
85
|
+
"spec/shared/coordinate_target.rb",
|
86
|
+
"spec/shared/command.rb",
|
87
|
+
"spec/shared/direction.rb"
|
88
88
|
]
|
89
89
|
|
90
90
|
if s.respond_to? :specification_version then
|
91
91
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
92
92
|
s.specification_version = 3
|
93
93
|
|
94
|
-
if Gem::Version.new(Gem::
|
94
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
95
95
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
96
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.3.5"])
|
96
97
|
else
|
97
98
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
99
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
98
100
|
end
|
99
101
|
else
|
100
102
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
103
|
+
s.add_dependency(%q<activesupport>, [">= 2.3.5"])
|
101
104
|
end
|
102
105
|
end
|
103
106
|
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: savage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Jeremy Holland
|
@@ -9,19 +15,41 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-08-26 00:00:00 -05:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
- 9
|
23
34
|
version: 1.2.9
|
24
|
-
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activesupport
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 9
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 3
|
49
|
+
- 5
|
50
|
+
version: 2.3.5
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
25
53
|
description: A little gem for extracting and manipulating SVG vector path data.
|
26
54
|
email: jeremy@jeremypholland.com
|
27
55
|
executables: []
|
@@ -85,40 +113,46 @@ rdoc_options:
|
|
85
113
|
require_paths:
|
86
114
|
- lib
|
87
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
88
117
|
requirements:
|
89
118
|
- - ">="
|
90
119
|
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 0
|
91
123
|
version: "0"
|
92
|
-
version:
|
93
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
94
126
|
requirements:
|
95
127
|
- - ">="
|
96
128
|
- !ruby/object:Gem::Version
|
129
|
+
hash: 3
|
130
|
+
segments:
|
131
|
+
- 0
|
97
132
|
version: "0"
|
98
|
-
version:
|
99
133
|
requirements: []
|
100
134
|
|
101
135
|
rubyforge_project:
|
102
|
-
rubygems_version: 1.3.
|
136
|
+
rubygems_version: 1.3.7
|
103
137
|
signing_key:
|
104
138
|
specification_version: 3
|
105
139
|
summary: A little library to manipulate SVG path data
|
106
140
|
test_files:
|
107
|
-
- spec/
|
108
|
-
- spec/savage/directions/
|
109
|
-
- spec/savage/directions/cubic_curve_to_spec.rb
|
110
|
-
- spec/savage/directions/horizontal_to_spec.rb
|
141
|
+
- spec/savage_spec.rb
|
142
|
+
- spec/savage/directions/point_spec.rb
|
111
143
|
- spec/savage/directions/line_to_spec.rb
|
112
144
|
- spec/savage/directions/move_to_spec.rb
|
113
|
-
- spec/savage/directions/point_spec.rb
|
114
145
|
- spec/savage/directions/quadratic_curve_spec.rb
|
146
|
+
- spec/savage/directions/cubic_curve_to_spec.rb
|
147
|
+
- spec/savage/directions/arc_to_spec.rb
|
115
148
|
- spec/savage/directions/vertical_to_spec.rb
|
149
|
+
- spec/savage/directions/close_path_spec.rb
|
150
|
+
- spec/savage/directions/horizontal_to_spec.rb
|
151
|
+
- spec/savage/sub_path_spec.rb
|
116
152
|
- spec/savage/parser_spec.rb
|
117
153
|
- spec/savage/path_spec.rb
|
118
|
-
- spec/
|
119
|
-
- spec/
|
120
|
-
- spec/shared/command.rb
|
154
|
+
- spec/spec_helper.rb
|
155
|
+
- spec/shared/point_target.rb
|
121
156
|
- spec/shared/coordinate_target.rb
|
157
|
+
- spec/shared/command.rb
|
122
158
|
- spec/shared/direction.rb
|
123
|
-
- spec/shared/point_target.rb
|
124
|
-
- spec/spec_helper.rb
|