builder 3.2.3 → 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 +2 -2
- 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.rb +1 -0
- data/lib/builder/blankslate.rb +1 -0
- data/lib/builder/version.rb +2 -1
- data/lib/builder/xchar.rb +1 -0
- data/lib/builder/xmlbase.rb +2 -1
- data/lib/builder/xmlevents.rb +1 -0
- data/lib/builder/xmlmarkup.rb +7 -1
- data/rakelib/publish.rake +1 -0
- data/rakelib/tags.rake +1 -0
- data/rakelib/testing.rake +1 -0
- data/test/helper.rb +1 -0
- data/test/performance.rb +2 -1
- data/test/preload.rb +1 -0
- data/test/test_blankslate.rb +1 -6
- data/test/test_eventbuilder.rb +1 -0
- data/test/test_markupbuilder.rb +8 -2
- data/test/test_method_caching.rb +1 -0
- data/test/test_namecollision.rb +1 -0
- data/test/test_xchar.rb +13 -6
- metadata +15 -5
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
@@ -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.rb
CHANGED
data/lib/builder/blankslate.rb
CHANGED
data/lib/builder/version.rb
CHANGED
data/lib/builder/xchar.rb
CHANGED
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/rakelib/publish.rake
CHANGED
data/rakelib/tags.rake
CHANGED
data/rakelib/testing.rake
CHANGED
data/test/helper.rb
CHANGED
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).
|
@@ -104,12 +105,6 @@ class TestBlankSlate < Builder::Test
|
|
104
105
|
end
|
105
106
|
end
|
106
107
|
|
107
|
-
def test_targetted_private_methods_are_undefined_during_instance_eval
|
108
|
-
assert_raise(NoMethodError, NameError) do
|
109
|
-
@bs.instance_eval do self.puts "HI" end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
108
|
def test_untargetted_private_methods_are_defined_during_instance_eval
|
114
109
|
oldstdout = $stdout
|
115
110
|
$stdout = StringIO.new
|
data/test/test_eventbuilder.rb
CHANGED
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).
|
@@ -417,6 +418,11 @@ class TestSpecialMarkup < Builder::Test
|
|
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!
|
@@ -499,7 +505,7 @@ class TestIndentedXmlMarkup < Builder::Test
|
|
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
|
@@ -580,7 +586,7 @@ class TestIndentedXmlMarkup < Builder::Test
|
|
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
data/test/test_namecollision.rb
CHANGED
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
|
#--
|
@@ -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
|
@@ -70,9 +71,15 @@ class TestXmlEscaping < Builder::Test
|
|
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
|
@@ -19,12 +19,23 @@ description: |
|
|
19
19
|
email: jim.weirich@gmail.com
|
20
20
|
executables: []
|
21
21
|
extensions: []
|
22
|
-
extra_rdoc_files:
|
22
|
+
extra_rdoc_files:
|
23
|
+
- CHANGES
|
24
|
+
- MIT-LICENSE
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- builder.blurb
|
28
|
+
- builder.gemspec
|
29
|
+
- doc/releases/builder-1.2.4.rdoc
|
30
|
+
- doc/releases/builder-2.0.0.rdoc
|
31
|
+
- doc/releases/builder-2.1.1.rdoc
|
23
32
|
files:
|
24
33
|
- CHANGES
|
25
34
|
- MIT-LICENSE
|
26
35
|
- README.md
|
27
36
|
- Rakefile
|
37
|
+
- builder.blurb
|
38
|
+
- builder.gemspec
|
28
39
|
- doc/jamis.rb
|
29
40
|
- doc/releases/builder-1.2.4.rdoc
|
30
41
|
- doc/releases/builder-2.0.0.rdoc
|
@@ -73,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
84
|
- !ruby/object:Gem::Version
|
74
85
|
version: '0'
|
75
86
|
requirements: []
|
76
|
-
|
77
|
-
rubygems_version: 2.6.8
|
87
|
+
rubygems_version: 3.1.0.pre3
|
78
88
|
signing_key:
|
79
89
|
specification_version: 4
|
80
90
|
summary: Builders for MarkUp.
|