builder 3.2.2 → 3.2.3
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/README.md +2 -2
- data/lib/builder/version.rb +1 -1
- data/lib/builder/xchar.rb +4 -4
- data/rakelib/publish.rake +3 -0
- data/rakelib/tags.rake +2 -2
- data/rakelib/testing.rake +7 -0
- data/test/helper.rb +12 -0
- data/test/test_blankslate.rb +3 -7
- data/test/test_eventbuilder.rb +3 -3
- data/test/test_markupbuilder.rb +13 -13
- data/test/test_method_caching.rb +3 -3
- data/test/test_namecollision.rb +2 -2
- data/test/test_xchar.rb +2 -2
- metadata +13 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 505b295fe83c35703399477bd6cff50dade8b7f1
|
4
|
+
data.tar.gz: 3029bd550b33392484c1f662cac290d8d8f49d41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee06b4bec85d9bb75353ebf14dbf78af08f7104e0478e353a7a44f67598735a5361ba9a09fadae89ff8447e4b08b28975531fbb726c5243c4233c678d6eea0b7
|
7
|
+
data.tar.gz: f7214747cf82a8879e5ab9e6304691f4f7b365f842d838ae8bf3ea148a766286a6951656cb90070506080b5590e1d8e3595e74a6e501ef90d68f7efe51d601b1
|
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Builder::XmlEvents:: Generate XML events (i.e. SAX-like)
|
|
23
23
|
require_gem 'builder', '~> 2.0'
|
24
24
|
|
25
25
|
builder = Builder::XmlMarkup.new
|
26
|
-
|
26
|
+
xml = builder.person { |b| b.name("Jim"); b.phone("555-1234") }
|
27
27
|
xml #=> <person><name>Jim</name><phone>555-1234</phone></person>
|
28
28
|
```
|
29
29
|
|
@@ -62,7 +62,7 @@ request on the 1.x Builder series.
|
|
62
62
|
|
63
63
|
Starting with Builder version 2.0.0, all attribute values expressed as
|
64
64
|
strings will be processed and the appropriate characters will be
|
65
|
-
escaped (e.g. "&" will be translated to "&"). Attribute values
|
65
|
+
escaped (e.g. "&" will be translated to "&amp;"). Attribute values
|
66
66
|
that are expressed as Symbol values will not be processed for escaped
|
67
67
|
characters and will be unchanged in output. (Yes, this probably counts
|
68
68
|
as Symbol abuse, but the convention is convenient and flexible).
|
data/lib/builder/version.rb
CHANGED
data/lib/builder/xchar.rb
CHANGED
@@ -19,7 +19,7 @@ end
|
|
19
19
|
|
20
20
|
if ! defined?(Builder::XChar) and ! String.method_defined?(:encode)
|
21
21
|
Builder.check_for_name_collision(String, "to_xs")
|
22
|
-
Builder.check_for_name_collision(
|
22
|
+
Builder.check_for_name_collision(Integer, "xchr")
|
23
23
|
end
|
24
24
|
|
25
25
|
######################################################################
|
@@ -108,7 +108,7 @@ if String.method_defined?(:encode)
|
|
108
108
|
INVALID_XML_CHAR = Regexp.new('[^'+
|
109
109
|
Builder::XChar::VALID.map { |item|
|
110
110
|
case item
|
111
|
-
when
|
111
|
+
when Integer
|
112
112
|
[item].pack('U').force_encoding('utf-8')
|
113
113
|
when Range
|
114
114
|
[item.first, '-'.ord, item.last].pack('UUU').force_encoding('utf-8')
|
@@ -160,9 +160,9 @@ if String.method_defined?(:encode)
|
|
160
160
|
else
|
161
161
|
|
162
162
|
######################################################################
|
163
|
-
# Enhance the
|
163
|
+
# Enhance the Integer class with a XML escaped character conversion.
|
164
164
|
#
|
165
|
-
class
|
165
|
+
class Integer
|
166
166
|
XChar = Builder::XChar if ! defined?(XChar)
|
167
167
|
|
168
168
|
# XML escaped version of chr. When <tt>escape</tt> is set to false
|
data/rakelib/publish.rake
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Optional publish task for Rake
|
2
2
|
|
3
|
+
begin
|
3
4
|
require 'rake/contrib/sshpublisher'
|
4
5
|
require 'rake/contrib/rubyforgepublisher'
|
5
6
|
|
@@ -15,3 +16,5 @@ desc "Publish the Documentation to RubyForge."
|
|
15
16
|
task :publish => [:rdoc] do
|
16
17
|
publisher.upload
|
17
18
|
end
|
19
|
+
rescue LoadError
|
20
|
+
end
|
data/rakelib/tags.rake
CHANGED
@@ -12,8 +12,8 @@ module Tags
|
|
12
12
|
|
13
13
|
PROJECT_DIR = ['.']
|
14
14
|
|
15
|
-
RVM_GEMDIR = File.join(`rvm gemdir`.strip, "gems")
|
16
|
-
SYSTEM_DIRS = File.exists?(RVM_GEMDIR) ? RVM_GEMDIR : []
|
15
|
+
RVM_GEMDIR = File.join(`rvm gemdir`.strip, "gems") rescue nil
|
16
|
+
SYSTEM_DIRS = RVM_GEMDIR && File.exists?(RVM_GEMDIR) ? RVM_GEMDIR : []
|
17
17
|
|
18
18
|
module_function
|
19
19
|
|
data/test/helper.rb
ADDED
data/test/test_blankslate.rb
CHANGED
@@ -10,8 +10,8 @@
|
|
10
10
|
# above copyright notice is included.
|
11
11
|
#++
|
12
12
|
|
13
|
-
require '
|
14
|
-
require '
|
13
|
+
require 'helper'
|
14
|
+
require 'preload'
|
15
15
|
require 'blankslate'
|
16
16
|
require 'stringio'
|
17
17
|
|
@@ -46,10 +46,6 @@ module Kernel
|
|
46
46
|
1234
|
47
47
|
end
|
48
48
|
|
49
|
-
def double_late_addition
|
50
|
-
11
|
51
|
-
end
|
52
|
-
|
53
49
|
def double_late_addition
|
54
50
|
22
|
55
51
|
end
|
@@ -80,7 +76,7 @@ end
|
|
80
76
|
######################################################################
|
81
77
|
# Test case for blank slate.
|
82
78
|
#
|
83
|
-
class TestBlankSlate < Test
|
79
|
+
class TestBlankSlate < Builder::Test
|
84
80
|
def setup
|
85
81
|
@bs = BlankSlate.new
|
86
82
|
end
|
data/test/test_eventbuilder.rb
CHANGED
@@ -10,12 +10,12 @@
|
|
10
10
|
# above copyright notice is included.
|
11
11
|
#++
|
12
12
|
|
13
|
-
require '
|
14
|
-
require '
|
13
|
+
require 'helper'
|
14
|
+
require 'preload'
|
15
15
|
require 'builder'
|
16
16
|
require 'builder/xmlevents'
|
17
17
|
|
18
|
-
class TestEvents < Test
|
18
|
+
class TestEvents < Builder::Test
|
19
19
|
|
20
20
|
class Target
|
21
21
|
attr_reader :events
|
data/test/test_markupbuilder.rb
CHANGED
@@ -10,12 +10,12 @@
|
|
10
10
|
# above copyright notice is included.
|
11
11
|
#++
|
12
12
|
|
13
|
-
require '
|
14
|
-
require '
|
13
|
+
require 'helper'
|
14
|
+
require 'preload'
|
15
15
|
require 'builder'
|
16
16
|
require 'builder/xmlmarkup'
|
17
17
|
|
18
|
-
class TestMarkup < Test
|
18
|
+
class TestMarkup < Builder::Test
|
19
19
|
def setup
|
20
20
|
@xml = Builder::XmlMarkup.new
|
21
21
|
end
|
@@ -79,7 +79,7 @@ class TestMarkup < Test::Unit::TestCase
|
|
79
79
|
assert_equal %{<ref id="H&R"/>}, @xml.target!
|
80
80
|
end
|
81
81
|
|
82
|
-
|
82
|
+
def test_symbol_attributes_are_unescaped_by_default
|
83
83
|
@xml.ref(:id => :"H&R")
|
84
84
|
assert_equal %{<ref id="H&R"/>}, @xml.target!
|
85
85
|
end
|
@@ -144,7 +144,7 @@ class TestMarkup < Test::Unit::TestCase
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def test_reference_methods
|
147
|
-
@xml.title { |x| x.a { x.b(
|
147
|
+
@xml.title { |x| x.a { x.b(_name) } }
|
148
148
|
assert_equal "<title><a><b>bob</b></a></title>", @xml.target!
|
149
149
|
end
|
150
150
|
|
@@ -205,12 +205,12 @@ class TestMarkup < Test::Unit::TestCase
|
|
205
205
|
assert_equal "<div><span><a href=\"ref\">text</a></span></div>", @xml.target!
|
206
206
|
end
|
207
207
|
|
208
|
-
def
|
208
|
+
def _name
|
209
209
|
"bob"
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
-
class TestAttributeEscaping < Test
|
213
|
+
class TestAttributeEscaping < Builder::Test
|
214
214
|
|
215
215
|
def setup
|
216
216
|
@xml = Builder::XmlMarkup.new
|
@@ -248,7 +248,7 @@ class TestAttributeEscaping < Test::Unit::TestCase
|
|
248
248
|
|
249
249
|
end
|
250
250
|
|
251
|
-
class TestNameSpaces < Test
|
251
|
+
class TestNameSpaces < Builder::Test
|
252
252
|
def setup
|
253
253
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
254
254
|
end
|
@@ -300,7 +300,7 @@ class TestNameSpaces < Test::Unit::TestCase
|
|
300
300
|
end
|
301
301
|
end
|
302
302
|
|
303
|
-
class TestDeclarations < Test
|
303
|
+
class TestDeclarations < Builder::Test
|
304
304
|
def setup
|
305
305
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
306
306
|
end
|
@@ -357,7 +357,7 @@ class TestDeclarations < Test::Unit::TestCase
|
|
357
357
|
end
|
358
358
|
|
359
359
|
|
360
|
-
class TestSpecialMarkup < Test
|
360
|
+
class TestSpecialMarkup < Builder::Test
|
361
361
|
def setup
|
362
362
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
363
363
|
end
|
@@ -428,7 +428,7 @@ class TestSpecialMarkup < Test::Unit::TestCase
|
|
428
428
|
end
|
429
429
|
end
|
430
430
|
|
431
|
-
class TestIndentedXmlMarkup < Test
|
431
|
+
class TestIndentedXmlMarkup < Builder::Test
|
432
432
|
def setup
|
433
433
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
434
434
|
end
|
@@ -452,7 +452,7 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
|
|
452
452
|
assert_equal " <name>\n <first>Jim</first>\n </name>\n", @xml.target!
|
453
453
|
end
|
454
454
|
|
455
|
-
class TestUtfMarkup < Test
|
455
|
+
class TestUtfMarkup < Builder::Test
|
456
456
|
if ! String.method_defined?(:encode)
|
457
457
|
def setup
|
458
458
|
@old_kcode = $KCODE
|
@@ -540,7 +540,7 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
|
|
540
540
|
end
|
541
541
|
end
|
542
542
|
|
543
|
-
class TestXmlEvents < Test
|
543
|
+
class TestXmlEvents < Builder::Test
|
544
544
|
def setup
|
545
545
|
@handler = EventHandler.new
|
546
546
|
@xe = Builder::XmlEvents.new(:target=>@handler)
|
data/test/test_method_caching.rb
CHANGED
@@ -9,11 +9,11 @@
|
|
9
9
|
# above copyright notice is included.
|
10
10
|
#++
|
11
11
|
|
12
|
-
require '
|
13
|
-
require '
|
12
|
+
require 'helper'
|
13
|
+
require 'preload'
|
14
14
|
require 'builder'
|
15
15
|
|
16
|
-
class TestMethodCaching < Test
|
16
|
+
class TestMethodCaching < Builder::Test
|
17
17
|
|
18
18
|
# We can directly ask if xml object responds to the cache_me or
|
19
19
|
# do_not_cache_me methods because xml is derived from BasicObject
|
data/test/test_namecollision.rb
CHANGED
@@ -10,10 +10,10 @@
|
|
10
10
|
# above copyright notice is included.
|
11
11
|
#++
|
12
12
|
|
13
|
-
require '
|
13
|
+
require 'helper'
|
14
14
|
require 'builder/xchar'
|
15
15
|
|
16
|
-
class TestNameCollisions < Test
|
16
|
+
class TestNameCollisions < Builder::Test
|
17
17
|
module Collide
|
18
18
|
def xchr
|
19
19
|
end
|
data/test/test_xchar.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
|
14
14
|
#!/usr/bin/env ruby
|
15
15
|
|
16
|
-
require '
|
16
|
+
require 'helper'
|
17
17
|
require 'builder/xchar'
|
18
18
|
|
19
19
|
if String.method_defined?(:encode)
|
@@ -35,7 +35,7 @@ if String.method_defined?(:encode)
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
class TestXmlEscaping < Test
|
38
|
+
class TestXmlEscaping < Builder::Test
|
39
39
|
REPLACEMENT_CHAR = Builder::XChar::REPLACEMENT_CHAR.to_xs
|
40
40
|
|
41
41
|
def test_ascii
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Weirich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Builder provides a number of builder objects that make creating structured data
|
@@ -19,14 +19,7 @@ description: |
|
|
19
19
|
email: jim.weirich@gmail.com
|
20
20
|
executables: []
|
21
21
|
extensions: []
|
22
|
-
extra_rdoc_files:
|
23
|
-
- CHANGES
|
24
|
-
- MIT-LICENSE
|
25
|
-
- README.md
|
26
|
-
- Rakefile
|
27
|
-
- doc/releases/builder-1.2.4.rdoc
|
28
|
-
- doc/releases/builder-2.0.0.rdoc
|
29
|
-
- doc/releases/builder-2.1.1.rdoc
|
22
|
+
extra_rdoc_files: []
|
30
23
|
files:
|
31
24
|
- CHANGES
|
32
25
|
- MIT-LICENSE
|
@@ -44,6 +37,10 @@ files:
|
|
44
37
|
- lib/builder/xmlbase.rb
|
45
38
|
- lib/builder/xmlevents.rb
|
46
39
|
- lib/builder/xmlmarkup.rb
|
40
|
+
- rakelib/publish.rake
|
41
|
+
- rakelib/tags.rake
|
42
|
+
- rakelib/testing.rake
|
43
|
+
- test/helper.rb
|
47
44
|
- test/performance.rb
|
48
45
|
- test/preload.rb
|
49
46
|
- test/test_blankslate.rb
|
@@ -52,34 +49,32 @@ files:
|
|
52
49
|
- test/test_method_caching.rb
|
53
50
|
- test/test_namecollision.rb
|
54
51
|
- test/test_xchar.rb
|
55
|
-
- rakelib/publish.rake
|
56
|
-
- rakelib/tags.rake
|
57
52
|
homepage: http://onestepback.org
|
58
53
|
licenses:
|
59
54
|
- MIT
|
60
55
|
metadata: {}
|
61
56
|
post_install_message:
|
62
57
|
rdoc_options:
|
63
|
-
- --title
|
58
|
+
- "--title"
|
64
59
|
- Builder -- Easy XML Building
|
65
|
-
- --main
|
60
|
+
- "--main"
|
66
61
|
- README.rdoc
|
67
|
-
- --line-numbers
|
62
|
+
- "--line-numbers"
|
68
63
|
require_paths:
|
69
64
|
- lib
|
70
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
66
|
requirements:
|
72
|
-
- -
|
67
|
+
- - ">="
|
73
68
|
- !ruby/object:Gem::Version
|
74
69
|
version: '0'
|
75
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
71
|
requirements:
|
77
|
-
- -
|
72
|
+
- - ">="
|
78
73
|
- !ruby/object:Gem::Version
|
79
74
|
version: '0'
|
80
75
|
requirements: []
|
81
76
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
77
|
+
rubygems_version: 2.6.8
|
83
78
|
signing_key:
|
84
79
|
specification_version: 4
|
85
80
|
summary: Builders for MarkUp.
|