builder 3.2.2 → 3.2.4
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 +5 -5
- data/CHANGES +13 -1
- data/README.md +4 -4
- data/Rakefile +2 -3
- data/builder.blurb +27 -0
- data/builder.gemspec +45 -0
- data/doc/jamis.rb +1 -0
- data/lib/blankslate.rb +1 -0
- data/lib/builder/blankslate.rb +1 -0
- data/lib/builder/version.rb +2 -1
- data/lib/builder/xchar.rb +5 -4
- data/lib/builder/xmlbase.rb +2 -1
- data/lib/builder/xmlevents.rb +1 -0
- data/lib/builder/xmlmarkup.rb +7 -1
- data/lib/builder.rb +1 -0
- data/rakelib/publish.rake +4 -0
- data/rakelib/tags.rake +3 -2
- data/rakelib/testing.rake +8 -0
- data/test/helper.rb +13 -0
- data/test/performance.rb +2 -1
- data/test/preload.rb +1 -0
- data/test/test_blankslate.rb +4 -13
- data/test/test_eventbuilder.rb +4 -3
- data/test/test_markupbuilder.rb +21 -15
- data/test/test_method_caching.rb +4 -3
- data/test/test_namecollision.rb +3 -2
- data/test/test_xchar.rb +15 -8
- metadata +16 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 386ed394ff60c6aff710d3304b69fac8ead0e6c89b80f80691b434fcb772290f
|
4
|
+
data.tar.gz: 42ccc387ac8ba03c586bf3b280977292418e96031e859ea764808a8d132e5654
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76c76d003cc4198733b46dfb9078d130a298c90a5fda954b521c965ae91c891212be43808b29b0d55824b4f3cdfa96289ea2267a57425713725a3ef30b930d83
|
7
|
+
data.tar.gz: dba82177c0a2ef38fdafbe1bb875487ad8e112b1f298c06a4a6c001c267172bd1043245229f45839bcdd64e0f2cc8093f7a4d27a5839b65446926560b936463d
|
data/CHANGES
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
= Change Log
|
2
2
|
|
3
|
-
== Version 3.2.
|
3
|
+
== Version 3.2.3 (2017-01-13)
|
4
|
+
|
5
|
+
* Support for Ruby 2.4
|
6
|
+
|
7
|
+
== Version 3.2.2 (2013-06-01
|
8
|
+
|
9
|
+
* Misc minor fixes
|
10
|
+
|
11
|
+
== Version 3.2.1 (2013-05-30)
|
12
|
+
|
13
|
+
* Travis & Rdoc fixes
|
14
|
+
|
15
|
+
== Version 3.2.0 (2013-02-23)
|
4
16
|
|
5
17
|
* Ruby 2.0 compatibility changes.
|
6
18
|
|
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).
|
@@ -245,8 +245,8 @@ incompatibility are:
|
|
245
245
|
| Description | Link |
|
246
246
|
| :----: | :----: |
|
247
247
|
| Documents | http://builder.rubyforge.org/ |
|
248
|
-
| Github Clone | git://github.com/
|
249
|
-
| Issue / Bug Reports | https://github.com/
|
248
|
+
| Github Clone | git://github.com/tenderlove/builder.git |
|
249
|
+
| Issue / Bug Reports | https://github.com/tenderlove/builder/issues?state=open |
|
250
250
|
|
251
251
|
## Contact
|
252
252
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Rakefile for rake -*- ruby -*-
|
2
3
|
|
3
4
|
# Copyright 2004, 2005, 2006 by Jim Weirich (jim@weirichhouse.org).
|
@@ -43,7 +44,7 @@ task :tu => [:test_units]
|
|
43
44
|
|
44
45
|
Rake::TestTask.new("test_units") do |t|
|
45
46
|
t.test_files = FileList['test/test*.rb']
|
46
|
-
t.libs << "."
|
47
|
+
t.libs << "." << "test"
|
47
48
|
t.verbose = false
|
48
49
|
end
|
49
50
|
|
@@ -104,7 +105,6 @@ simple to do. Currently the following builder objects are supported:
|
|
104
105
|
|
105
106
|
s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ }
|
106
107
|
|
107
|
-
s.has_rdoc = true
|
108
108
|
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
|
109
109
|
s.rdoc_options <<
|
110
110
|
'--title' << 'Builder -- Easy XML Building' <<
|
@@ -135,7 +135,6 @@ classes that make heavy use of method_missing.
|
|
135
135
|
|
136
136
|
s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ }
|
137
137
|
|
138
|
-
s.has_rdoc = true
|
139
138
|
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
|
140
139
|
s.rdoc_options <<
|
141
140
|
'--title' << 'BlankSlate -- Base Class for building proxies.' <<
|
data/builder.blurb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
name: builder
|
2
|
+
document: http://builder.rubyforge.org
|
3
|
+
download: http://rubyforge.org/frs/?group_id=415
|
4
|
+
description: >
|
5
|
+
<p>This package contains Builder, a simple ruby library for
|
6
|
+
building XML document quickly and easily.</p>
|
7
|
+
|
8
|
+
<p>Here's an example:</p>
|
9
|
+
|
10
|
+
<pre>
|
11
|
+
xml = Builder::XmlMarkup.new(:indent=>2)
|
12
|
+
xml.person {
|
13
|
+
xml.first_name("Jim")
|
14
|
+
xml.last_name("Weirich")
|
15
|
+
}
|
16
|
+
puts xml.target!
|
17
|
+
</pre>
|
18
|
+
|
19
|
+
<p>Produces:</p>
|
20
|
+
|
21
|
+
<pre>
|
22
|
+
<person>
|
23
|
+
<first_name>Jim</first_name>
|
24
|
+
<last_name>Weirich</last_name>
|
25
|
+
</person>
|
26
|
+
</pre>
|
27
|
+
|
data/builder.gemspec
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require './lib/builder/version'
|
3
|
+
|
4
|
+
PKG_VERSION = Builder::VERSION
|
5
|
+
|
6
|
+
PKG_FILES = Dir[
|
7
|
+
'[A-Z]*',
|
8
|
+
'doc/**/*',
|
9
|
+
'lib/**/*.rb',
|
10
|
+
'test/**/*.rb',
|
11
|
+
'rakelib/**/*'
|
12
|
+
]
|
13
|
+
|
14
|
+
Gem::Specification.new do |s|
|
15
|
+
|
16
|
+
#### Basic information.
|
17
|
+
|
18
|
+
s.name = 'builder'
|
19
|
+
s.version = PKG_VERSION
|
20
|
+
s.summary = "Builders for MarkUp."
|
21
|
+
s.description = %{\
|
22
|
+
Builder provides a number of builder objects that make creating structured data
|
23
|
+
simple to do. Currently the following builder objects are supported:
|
24
|
+
|
25
|
+
* XML Markup
|
26
|
+
* XML Events
|
27
|
+
}
|
28
|
+
|
29
|
+
s.files = PKG_FILES
|
30
|
+
s.require_path = 'lib'
|
31
|
+
|
32
|
+
s.test_files = PKG_FILES.select { |fn| fn =~ /^test\/test/ }
|
33
|
+
|
34
|
+
s.has_rdoc = true
|
35
|
+
# s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
|
36
|
+
s.rdoc_options <<
|
37
|
+
'--title' << 'Builder -- Easy XML Building' <<
|
38
|
+
'--main' << 'README.rdoc' <<
|
39
|
+
'--line-numbers'
|
40
|
+
|
41
|
+
s.authors = ["Jim Weirich", "Aaron Patterson"]
|
42
|
+
s.email = "aron.patterson@gmail.com"
|
43
|
+
s.homepage = "https://github.com/tenderlove/builder"
|
44
|
+
s.license = 'MIT'
|
45
|
+
end
|
data/doc/jamis.rb
CHANGED
data/lib/blankslate.rb
CHANGED
data/lib/builder/blankslate.rb
CHANGED
data/lib/builder/version.rb
CHANGED
data/lib/builder/xchar.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# The XChar library is provided courtesy of Sam Ruby (See
|
4
5
|
# http://intertwingly.net/stories/2005/09/28/xchar.rb)
|
@@ -19,7 +20,7 @@ end
|
|
19
20
|
|
20
21
|
if ! defined?(Builder::XChar) and ! String.method_defined?(:encode)
|
21
22
|
Builder.check_for_name_collision(String, "to_xs")
|
22
|
-
Builder.check_for_name_collision(
|
23
|
+
Builder.check_for_name_collision(Integer, "xchr")
|
23
24
|
end
|
24
25
|
|
25
26
|
######################################################################
|
@@ -108,7 +109,7 @@ if String.method_defined?(:encode)
|
|
108
109
|
INVALID_XML_CHAR = Regexp.new('[^'+
|
109
110
|
Builder::XChar::VALID.map { |item|
|
110
111
|
case item
|
111
|
-
when
|
112
|
+
when Integer
|
112
113
|
[item].pack('U').force_encoding('utf-8')
|
113
114
|
when Range
|
114
115
|
[item.first, '-'.ord, item.last].pack('UUU').force_encoding('utf-8')
|
@@ -160,9 +161,9 @@ if String.method_defined?(:encode)
|
|
160
161
|
else
|
161
162
|
|
162
163
|
######################################################################
|
163
|
-
# Enhance the
|
164
|
+
# Enhance the Integer class with a XML escaped character conversion.
|
164
165
|
#
|
165
|
-
class
|
166
|
+
class Integer
|
166
167
|
XChar = Builder::XChar if ! defined?(XChar)
|
167
168
|
|
168
169
|
# XML escaped version of chr. When <tt>escape</tt> is set to false
|
data/lib/builder/xmlbase.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'builder/blankslate'
|
4
5
|
|
@@ -52,7 +53,7 @@ module Builder
|
|
52
53
|
attrs ||= {}
|
53
54
|
attrs.merge!({:nil => true}) if explicit_nil_handling?
|
54
55
|
else
|
55
|
-
text ||= ''
|
56
|
+
text ||= ''.dup
|
56
57
|
text << arg.to_s
|
57
58
|
end
|
58
59
|
end
|
data/lib/builder/xmlevents.rb
CHANGED
data/lib/builder/xmlmarkup.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
#--
|
3
4
|
# Copyright 2004, 2005 by Jim Weirich (jim@weirichhouse.org).
|
4
5
|
# All rights reserved.
|
@@ -192,7 +193,7 @@ module Builder
|
|
192
193
|
@quote = (options[:quote] == :single) ? "'" : '"'
|
193
194
|
@explicit_nil_handling = options[:explicit_nil_handling]
|
194
195
|
super(indent, margin)
|
195
|
-
@target = options[:target] || ""
|
196
|
+
@target = options[:target] || "".dup
|
196
197
|
end
|
197
198
|
|
198
199
|
# Return the target of the builder.
|
@@ -271,6 +272,11 @@ module Builder
|
|
271
272
|
_special("<![CDATA[", "]]>", text.gsub(']]>', ']]]]><![CDATA[>'), nil)
|
272
273
|
end
|
273
274
|
|
275
|
+
def cdata_value!(open, text)
|
276
|
+
_ensure_no_block ::Kernel::block_given?
|
277
|
+
_special("<#{open}>", "</#{open}>", "<![CDATA[#{text.gsub(']]>', ']]]]><![CDATA[>')}]]>", nil)
|
278
|
+
end
|
279
|
+
|
274
280
|
private
|
275
281
|
|
276
282
|
# NOTE: All private methods of a builder object are prefixed when
|
data/lib/builder.rb
CHANGED
data/rakelib/publish.rake
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Optional publish task for Rake
|
2
3
|
|
4
|
+
begin
|
3
5
|
require 'rake/contrib/sshpublisher'
|
4
6
|
require 'rake/contrib/rubyforgepublisher'
|
5
7
|
|
@@ -15,3 +17,5 @@ desc "Publish the Documentation to RubyForge."
|
|
15
17
|
task :publish => [:rdoc] do
|
16
18
|
publisher.upload
|
17
19
|
end
|
20
|
+
rescue LoadError
|
21
|
+
end
|
data/rakelib/tags.rake
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Tags
|
4
5
|
extend Rake::DSL if defined?(Rake::DSL)
|
@@ -12,8 +13,8 @@ module Tags
|
|
12
13
|
|
13
14
|
PROJECT_DIR = ['.']
|
14
15
|
|
15
|
-
RVM_GEMDIR = File.join(`rvm gemdir`.strip, "gems")
|
16
|
-
SYSTEM_DIRS = File.exists?(RVM_GEMDIR) ? RVM_GEMDIR : []
|
16
|
+
RVM_GEMDIR = File.join(`rvm gemdir`.strip, "gems") rescue nil
|
17
|
+
SYSTEM_DIRS = RVM_GEMDIR && File.exists?(RVM_GEMDIR) ? RVM_GEMDIR : []
|
17
18
|
|
18
19
|
module_function
|
19
20
|
|
data/test/helper.rb
ADDED
data/test/performance.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
# encoding: iso-8859-1
|
3
4
|
|
4
5
|
#--
|
@@ -14,7 +15,7 @@
|
|
14
15
|
require 'builder/xmlmarkup'
|
15
16
|
require 'benchmark'
|
16
17
|
|
17
|
-
text = "This is a test of the new xml markup. I
|
18
|
+
text = "This is a test of the new xml markup. I�t�rn�ti�n�liz�ti�n\n" * 10000
|
18
19
|
|
19
20
|
include Benchmark # we need the CAPTION and FMTSTR constants
|
20
21
|
include Builder
|
data/test/preload.rb
CHANGED
data/test/test_blankslate.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
#--
|
4
5
|
# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
|
@@ -10,8 +11,8 @@
|
|
10
11
|
# above copyright notice is included.
|
11
12
|
#++
|
12
13
|
|
13
|
-
require '
|
14
|
-
require '
|
14
|
+
require 'helper'
|
15
|
+
require 'preload'
|
15
16
|
require 'blankslate'
|
16
17
|
require 'stringio'
|
17
18
|
|
@@ -46,10 +47,6 @@ module Kernel
|
|
46
47
|
1234
|
47
48
|
end
|
48
49
|
|
49
|
-
def double_late_addition
|
50
|
-
11
|
51
|
-
end
|
52
|
-
|
53
50
|
def double_late_addition
|
54
51
|
22
|
55
52
|
end
|
@@ -80,7 +77,7 @@ end
|
|
80
77
|
######################################################################
|
81
78
|
# Test case for blank slate.
|
82
79
|
#
|
83
|
-
class TestBlankSlate < Test
|
80
|
+
class TestBlankSlate < Builder::Test
|
84
81
|
def setup
|
85
82
|
@bs = BlankSlate.new
|
86
83
|
end
|
@@ -108,12 +105,6 @@ class TestBlankSlate < Test::Unit::TestCase
|
|
108
105
|
end
|
109
106
|
end
|
110
107
|
|
111
|
-
def test_targetted_private_methods_are_undefined_during_instance_eval
|
112
|
-
assert_raise(NoMethodError, NameError) do
|
113
|
-
@bs.instance_eval do self.puts "HI" end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
108
|
def test_untargetted_private_methods_are_defined_during_instance_eval
|
118
109
|
oldstdout = $stdout
|
119
110
|
$stdout = StringIO.new
|
data/test/test_eventbuilder.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
#--
|
4
5
|
# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
|
@@ -10,12 +11,12 @@
|
|
10
11
|
# above copyright notice is included.
|
11
12
|
#++
|
12
13
|
|
13
|
-
require '
|
14
|
-
require '
|
14
|
+
require 'helper'
|
15
|
+
require 'preload'
|
15
16
|
require 'builder'
|
16
17
|
require 'builder/xmlevents'
|
17
18
|
|
18
|
-
class TestEvents < Test
|
19
|
+
class TestEvents < Builder::Test
|
19
20
|
|
20
21
|
class Target
|
21
22
|
attr_reader :events
|
data/test/test_markupbuilder.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
#--
|
4
5
|
# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
|
@@ -10,12 +11,12 @@
|
|
10
11
|
# above copyright notice is included.
|
11
12
|
#++
|
12
13
|
|
13
|
-
require '
|
14
|
-
require '
|
14
|
+
require 'helper'
|
15
|
+
require 'preload'
|
15
16
|
require 'builder'
|
16
17
|
require 'builder/xmlmarkup'
|
17
18
|
|
18
|
-
class TestMarkup < Test
|
19
|
+
class TestMarkup < Builder::Test
|
19
20
|
def setup
|
20
21
|
@xml = Builder::XmlMarkup.new
|
21
22
|
end
|
@@ -79,7 +80,7 @@ class TestMarkup < Test::Unit::TestCase
|
|
79
80
|
assert_equal %{<ref id="H&R"/>}, @xml.target!
|
80
81
|
end
|
81
82
|
|
82
|
-
|
83
|
+
def test_symbol_attributes_are_unescaped_by_default
|
83
84
|
@xml.ref(:id => :"H&R")
|
84
85
|
assert_equal %{<ref id="H&R"/>}, @xml.target!
|
85
86
|
end
|
@@ -144,7 +145,7 @@ class TestMarkup < Test::Unit::TestCase
|
|
144
145
|
end
|
145
146
|
|
146
147
|
def test_reference_methods
|
147
|
-
@xml.title { |x| x.a { x.b(
|
148
|
+
@xml.title { |x| x.a { x.b(_name) } }
|
148
149
|
assert_equal "<title><a><b>bob</b></a></title>", @xml.target!
|
149
150
|
end
|
150
151
|
|
@@ -205,12 +206,12 @@ class TestMarkup < Test::Unit::TestCase
|
|
205
206
|
assert_equal "<div><span><a href=\"ref\">text</a></span></div>", @xml.target!
|
206
207
|
end
|
207
208
|
|
208
|
-
def
|
209
|
+
def _name
|
209
210
|
"bob"
|
210
211
|
end
|
211
212
|
end
|
212
213
|
|
213
|
-
class TestAttributeEscaping < Test
|
214
|
+
class TestAttributeEscaping < Builder::Test
|
214
215
|
|
215
216
|
def setup
|
216
217
|
@xml = Builder::XmlMarkup.new
|
@@ -248,7 +249,7 @@ class TestAttributeEscaping < Test::Unit::TestCase
|
|
248
249
|
|
249
250
|
end
|
250
251
|
|
251
|
-
class TestNameSpaces < Test
|
252
|
+
class TestNameSpaces < Builder::Test
|
252
253
|
def setup
|
253
254
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
254
255
|
end
|
@@ -300,7 +301,7 @@ class TestNameSpaces < Test::Unit::TestCase
|
|
300
301
|
end
|
301
302
|
end
|
302
303
|
|
303
|
-
class TestDeclarations < Test
|
304
|
+
class TestDeclarations < Builder::Test
|
304
305
|
def setup
|
305
306
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
306
307
|
end
|
@@ -357,7 +358,7 @@ class TestDeclarations < Test::Unit::TestCase
|
|
357
358
|
end
|
358
359
|
|
359
360
|
|
360
|
-
class TestSpecialMarkup < Test
|
361
|
+
class TestSpecialMarkup < Builder::Test
|
361
362
|
def setup
|
362
363
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
363
364
|
end
|
@@ -417,6 +418,11 @@ class TestSpecialMarkup < Test::Unit::TestCase
|
|
417
418
|
assert_equal "<![CDATA[TEST]]>\n", @xml.target!
|
418
419
|
end
|
419
420
|
|
421
|
+
def test_cdata_value
|
422
|
+
@xml.cdata_value!("content:encoded", "<p>TEST</p>")
|
423
|
+
assert_equal "<content:encoded><![CDATA[<p>TEST</p>]]></content:encoded>\n", @xml.target!
|
424
|
+
end
|
425
|
+
|
420
426
|
def test_cdata_with_ampersand
|
421
427
|
@xml.cdata!("TEST&CHECK")
|
422
428
|
assert_equal "<![CDATA[TEST&CHECK]]>\n", @xml.target!
|
@@ -428,7 +434,7 @@ class TestSpecialMarkup < Test::Unit::TestCase
|
|
428
434
|
end
|
429
435
|
end
|
430
436
|
|
431
|
-
class TestIndentedXmlMarkup < Test
|
437
|
+
class TestIndentedXmlMarkup < Builder::Test
|
432
438
|
def setup
|
433
439
|
@xml = Builder::XmlMarkup.new(:indent=>2)
|
434
440
|
end
|
@@ -452,7 +458,7 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
|
|
452
458
|
assert_equal " <name>\n <first>Jim</first>\n </name>\n", @xml.target!
|
453
459
|
end
|
454
460
|
|
455
|
-
class TestUtfMarkup < Test
|
461
|
+
class TestUtfMarkup < Builder::Test
|
456
462
|
if ! String.method_defined?(:encode)
|
457
463
|
def setup
|
458
464
|
@old_kcode = $KCODE
|
@@ -499,7 +505,7 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
|
|
499
505
|
$KCODE = encoding
|
500
506
|
string
|
501
507
|
elsif encoding == 'UTF8'
|
502
|
-
string.force_encoding('UTF-8')
|
508
|
+
string.dup.force_encoding('UTF-8')
|
503
509
|
else
|
504
510
|
string
|
505
511
|
end
|
@@ -540,7 +546,7 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
|
|
540
546
|
end
|
541
547
|
end
|
542
548
|
|
543
|
-
class TestXmlEvents < Test
|
549
|
+
class TestXmlEvents < Builder::Test
|
544
550
|
def setup
|
545
551
|
@handler = EventHandler.new
|
546
552
|
@xe = Builder::XmlEvents.new(:target=>@handler)
|
@@ -580,7 +586,7 @@ class TestIndentedXmlMarkup < Test::Unit::TestCase
|
|
580
586
|
end
|
581
587
|
|
582
588
|
def pop_text
|
583
|
-
result = ''
|
589
|
+
result = ''.dup
|
584
590
|
while ! @handler.events.empty? && @handler.events[0][0] == :text
|
585
591
|
result << @handler.events[0][1]
|
586
592
|
@handler.events.shift
|
data/test/test_method_caching.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
#--
|
4
5
|
# Portions copyright 2011 by Bart ten Brinke (info@retrosync.com).
|
@@ -9,11 +10,11 @@
|
|
9
10
|
# above copyright notice is included.
|
10
11
|
#++
|
11
12
|
|
12
|
-
require '
|
13
|
-
require '
|
13
|
+
require 'helper'
|
14
|
+
require 'preload'
|
14
15
|
require 'builder'
|
15
16
|
|
16
|
-
class TestMethodCaching < Test
|
17
|
+
class TestMethodCaching < Builder::Test
|
17
18
|
|
18
19
|
# We can directly ask if xml object responds to the cache_me or
|
19
20
|
# do_not_cache_me methods because xml is derived from BasicObject
|
data/test/test_namecollision.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
#--
|
4
5
|
# Portions copyright 2004 by Jim Weirich (jim@weirichhouse.org).
|
@@ -10,10 +11,10 @@
|
|
10
11
|
# above copyright notice is included.
|
11
12
|
#++
|
12
13
|
|
13
|
-
require '
|
14
|
+
require 'helper'
|
14
15
|
require 'builder/xchar'
|
15
16
|
|
16
|
-
class TestNameCollisions < Test
|
17
|
+
class TestNameCollisions < Builder::Test
|
17
18
|
module Collide
|
18
19
|
def xchr
|
19
20
|
end
|
data/test/test_xchar.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
# encoding: us-ascii
|
3
4
|
|
4
5
|
#--
|
@@ -13,7 +14,7 @@
|
|
13
14
|
|
14
15
|
#!/usr/bin/env ruby
|
15
16
|
|
16
|
-
require '
|
17
|
+
require 'helper'
|
17
18
|
require 'builder/xchar'
|
18
19
|
|
19
20
|
if String.method_defined?(:encode)
|
@@ -22,9 +23,9 @@ if String.method_defined?(:encode)
|
|
22
23
|
|
23
24
|
# shim method for testing purposes
|
24
25
|
def to_xs(escape=true)
|
25
|
-
raise NameError.new('to_xs') unless caller[0].index(__FILE__)
|
26
|
+
# raise NameError.new('to_xs') unless caller[0].index(__FILE__)
|
26
27
|
|
27
|
-
result = Builder::XChar.encode(self)
|
28
|
+
result = Builder::XChar.encode(self.dup)
|
28
29
|
if escape
|
29
30
|
result.gsub(/[^\u0000-\u007F]/) {|c| "&##{c.ord};"}
|
30
31
|
else
|
@@ -35,7 +36,7 @@ if String.method_defined?(:encode)
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
class TestXmlEscaping < Test
|
39
|
+
class TestXmlEscaping < Builder::Test
|
39
40
|
REPLACEMENT_CHAR = Builder::XChar::REPLACEMENT_CHAR.to_xs
|
40
41
|
|
41
42
|
def test_ascii
|
@@ -70,9 +71,15 @@ class TestXmlEscaping < Test::Unit::TestCase
|
|
70
71
|
end
|
71
72
|
|
72
73
|
def test_utf8_verbatim
|
73
|
-
assert_equal "\xE2\x80\x99", "\xE2\x80\x99".to_xs(false) # right single quote
|
74
|
-
assert_equal "\xC2\xA9", "\xC2\xA9".to_xs(false) # copy
|
75
|
-
assert_equal "\xC2\xA9&\xC2\xA9",
|
76
|
-
"\xC2\xA9&\xC2\xA9".to_xs(false)
|
74
|
+
assert_equal binary("\xE2\x80\x99"), "\xE2\x80\x99".to_xs(false) # right single quote
|
75
|
+
assert_equal binary("\xC2\xA9"), "\xC2\xA9".to_xs(false) # copy
|
76
|
+
assert_equal binary("\xC2\xA9&\xC2\xA9"),
|
77
|
+
"\xC2\xA9&\xC2\xA9".to_xs(false) # copy with ampersand
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def binary(string)
|
83
|
+
string.dup.force_encoding(Encoding::BINARY)
|
77
84
|
end
|
78
85
|
end
|
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.4
|
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: 2019-12-10 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
|
@@ -24,6 +24,8 @@ extra_rdoc_files:
|
|
24
24
|
- MIT-LICENSE
|
25
25
|
- README.md
|
26
26
|
- Rakefile
|
27
|
+
- builder.blurb
|
28
|
+
- builder.gemspec
|
27
29
|
- doc/releases/builder-1.2.4.rdoc
|
28
30
|
- doc/releases/builder-2.0.0.rdoc
|
29
31
|
- doc/releases/builder-2.1.1.rdoc
|
@@ -32,6 +34,8 @@ files:
|
|
32
34
|
- MIT-LICENSE
|
33
35
|
- README.md
|
34
36
|
- Rakefile
|
37
|
+
- builder.blurb
|
38
|
+
- builder.gemspec
|
35
39
|
- doc/jamis.rb
|
36
40
|
- doc/releases/builder-1.2.4.rdoc
|
37
41
|
- doc/releases/builder-2.0.0.rdoc
|
@@ -44,6 +48,10 @@ files:
|
|
44
48
|
- lib/builder/xmlbase.rb
|
45
49
|
- lib/builder/xmlevents.rb
|
46
50
|
- lib/builder/xmlmarkup.rb
|
51
|
+
- rakelib/publish.rake
|
52
|
+
- rakelib/tags.rake
|
53
|
+
- rakelib/testing.rake
|
54
|
+
- test/helper.rb
|
47
55
|
- test/performance.rb
|
48
56
|
- test/preload.rb
|
49
57
|
- test/test_blankslate.rb
|
@@ -52,34 +60,31 @@ files:
|
|
52
60
|
- test/test_method_caching.rb
|
53
61
|
- test/test_namecollision.rb
|
54
62
|
- test/test_xchar.rb
|
55
|
-
- rakelib/publish.rake
|
56
|
-
- rakelib/tags.rake
|
57
63
|
homepage: http://onestepback.org
|
58
64
|
licenses:
|
59
65
|
- MIT
|
60
66
|
metadata: {}
|
61
67
|
post_install_message:
|
62
68
|
rdoc_options:
|
63
|
-
- --title
|
69
|
+
- "--title"
|
64
70
|
- Builder -- Easy XML Building
|
65
|
-
- --main
|
71
|
+
- "--main"
|
66
72
|
- README.rdoc
|
67
|
-
- --line-numbers
|
73
|
+
- "--line-numbers"
|
68
74
|
require_paths:
|
69
75
|
- lib
|
70
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
77
|
requirements:
|
72
|
-
- -
|
78
|
+
- - ">="
|
73
79
|
- !ruby/object:Gem::Version
|
74
80
|
version: '0'
|
75
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
82
|
requirements:
|
77
|
-
- -
|
83
|
+
- - ">="
|
78
84
|
- !ruby/object:Gem::Version
|
79
85
|
version: '0'
|
80
86
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.0.3
|
87
|
+
rubygems_version: 3.1.0.pre3
|
83
88
|
signing_key:
|
84
89
|
specification_version: 4
|
85
90
|
summary: Builders for MarkUp.
|