sixarm_ruby_rexml 2.1.0

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.
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ \S��4Q��au��KH�~�ɼ6FK�M
2
+ �U��ᾀ ���‰{'��t[[�v6���+Urή N��<��<�����E֓A�7A��
data/.gemtest ADDED
File without changes
data/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # SixArm.com » Ruby » <br> REXML core for XML documents, elements, attributes
2
+
3
+ * Docs: <http://sixarm.com/sixarm_ruby_rexml/doc>
4
+ * Repo: <http://github.com/sixarm/sixarm_ruby_rexml>
5
+ * Email: Joel Parker Henderson, <joel@sixarm.com>
6
+
7
+
8
+ ## Introduction
9
+
10
+ This Ruby gem has REXML core extensions to help clean up XML.
11
+
12
+ * REXML::Attributes#to_a_hash: return a new hash of the attributes' name value pairs.
13
+ * REXML::Document#remove_attributes: remove all attributes from the document's elements.
14
+ * REXML::Element#remove_attributes: remove all attributes from the element.
15
+
16
+
17
+ ## Quickstart
18
+
19
+ Install:
20
+
21
+ gem install sixarm_ruby_rexml
22
+
23
+ Bundler:
24
+
25
+ gem "sixarm_ruby_rexml", "=2.1.0"
26
+
27
+ Require:
28
+
29
+ require "sixarm_ruby_rexml"
30
+
31
+
32
+ ## High Security (Optional)
33
+
34
+ To enable high security for all our gems:
35
+
36
+ wget http://sixarm.com/sixarm.pem
37
+ gem cert --add sixarm.pem
38
+ gem sources --add http://sixarm.com
39
+
40
+ To install with high security:
41
+
42
+ gem install sixarm_ruby_rexml --test --trust-policy HighSecurity
43
+
44
+
45
+ ## Example
46
+
47
+ Read an XML document then remove all its attributes:
48
+
49
+ require "sixarm_ruby_rexml"
50
+ xml = File.read("foo.xml")
51
+ doc = REXML::Document.new(xml)
52
+ doc.remove_attributes
53
+ puts doc.to_s
54
+
55
+
56
+ ## More
57
+
58
+ For docs go to <http://sixarm.com/sixarm_ruby_rexml/doc>
59
+
60
+ Want to help? We're happy to get pull requests.
61
+
62
+
63
+ ## Changes
64
+
65
+ * 2012-03-16 2.1.0 Upgrade for Ruby 1.9.3, minitest/spec, and improved docs.
66
+ * 2012-03-14 2.0.6 Rename Attributes#to_hash to #to_a_hash to unmask Ruby core Attributes#to_hash
67
+ * 2012-03-14 2.0.4 Fix file includes
68
+ * 2012-03-13 2.0.0 Lift the REXML extension from the sixarm_ruby_ramp gem
69
+
70
+
71
+ ## License
72
+
73
+ You may choose any of these open source licenses:
74
+
75
+ * Apache License
76
+ * BSD License
77
+ * CreativeCommons License, Non-commercial Share Alike
78
+ * GNU General Public License Version 2 (GPL 2)
79
+ * GNU Lesser General Public License (LGPL)
80
+ * MIT License
81
+ * Perl Artistic License
82
+ * Ruby License
83
+
84
+ The software is provided "as is", without warranty of any kind,
85
+ express or implied, including but not limited to the warranties of
86
+ merchantability, fitness for a particular purpose and noninfringement.
87
+
88
+ In no event shall the authors or copyright holders be liable for any
89
+ claim, damages or other liability, whether in an action of contract,
90
+ tort or otherwise, arising from, out of or in connection with the
91
+ software or the use or other dealings in the software.
92
+
93
+ This license is for the included software that is created by SixArm;
94
+ some of the included software may have its own licenses, copyrights,
95
+ authors, etc. and these do take precedence over the SixArm license.
96
+
97
+ Copyright (c) 2006-2013 Joel Parker Henderson.
98
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 2.0.6
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ require 'rexml/document'
7
+
8
+ ['attributes','document','element'].map{|x|
9
+ require File.dirname(__FILE__) + "/sixarm_ruby_rexml/#{x}.rb"
10
+ }
@@ -0,0 +1,12 @@
1
+ class REXML::Attributes
2
+
3
+ # @return a new hash of the attributes' name and value pairs.
4
+ #
5
+ # @example
6
+ # attributes.to_a_hash => {"src"=>"pic.jpg", "height" => "100", "width" => "200"}
7
+
8
+ def to_a_hash
9
+ to_a.inject({}){|hash, attribute| hash[attribute.name]=attribute.value; hash}
10
+ end
11
+
12
+ end
@@ -0,0 +1,14 @@
1
+ class REXML::Document
2
+
3
+ # Remove all attributes from the document's elements.
4
+ #
5
+ # @return the document.
6
+ #
7
+ # @see Element#remove_attributes
8
+
9
+ def remove_attributes
10
+ self.elements.each("//") { |elem| elem.attributes.each_attribute{|attribute| attribute.remove }}
11
+ self
12
+ end
13
+
14
+ end
@@ -0,0 +1,17 @@
1
+ class REXML::Element
2
+
3
+ # Remove all attributes from the element.
4
+ #
5
+ # @return the element.
6
+ #
7
+ # @see Document#remove_attributes
8
+
9
+ def remove_attributes
10
+ self.attributes.each_attribute{|attribute| attribute.remove }
11
+ self
12
+ end
13
+
14
+ end
15
+
16
+
17
+
@@ -0,0 +1,9 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'sixarm_ruby_rexml'
6
+
7
+ ['attributes','document','element'].map{|x|
8
+ require "sixarm_ruby_rexml_test/#{x}_test.rb"
9
+ }
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'minitest/autorun'
4
+ require 'simplecov'
5
+ SimpleCov.start
6
+ require 'sixarm_ruby_rexml'
7
+
8
+ describe REXML::Attributes do
9
+
10
+ describe "#to_a_hash" do
11
+
12
+ it "converts attributes to a hash of name value pairs" do
13
+ doc=REXML::Document.new('<foo a="b" c="d" e="f"/>')
14
+ expect={"a"=>"b","c"=>"d","e"=>"f"}
15
+ doc.elements['foo'].attributes.to_a_hash.must_equal expect
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'minitest/autorun'
4
+ require 'simplecov'
5
+ SimpleCov.start
6
+ require 'sixarm_ruby_rexml'
7
+
8
+ describe REXML::Document do
9
+
10
+ describe "#remove_attributes" do
11
+
12
+ it "returns XML text without attributes" do
13
+ xml="<foo a='b' c='d'><bar e='f' g='h'>text</bar></foo>"
14
+ expect="<foo><bar>text</bar></foo>"
15
+ doc=REXML::Document.new(xml)
16
+ doc.remove_attributes
17
+ doc.to_s.must_equal expect
18
+ end
19
+
20
+ end
21
+
22
+ end
23
+
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'minitest/autorun'
4
+ require 'simplecov'
5
+ SimpleCov.start
6
+ require 'sixarm_ruby_rexml'
7
+
8
+ describe REXML::Element do
9
+
10
+ describe "#remove_attributes" do
11
+
12
+ it "returns XML text without attibutes" do
13
+ xml="<foo a='b' c='d'><bar e='f' g='h'>text</bar></foo>"
14
+ expect="<foo><bar e='f' g='h'>text</bar></foo>"
15
+ doc=REXML::Document.new(xml)
16
+ doc.elements[1].remove_attributes
17
+ doc.to_s.must_equal expect
18
+ end
19
+
20
+ end
21
+
22
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_rexml
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - SixArm
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain:
12
+ - !binary |-
13
+ LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCRENDQW0yZ0F3SUJB
14
+ Z0lKQUtQd0VFVFU1YkhvTUEwR0NTcUdTSWIzRFFFQkJRVUFNR0F4Q3pBSkJn
15
+ TlYKQkFZVEFsVlRNUk13RVFZRFZRUUlFd3BEWVd4cFptOXlibWxoTVJZd0ZB
16
+ WURWUVFIRXcxVFlXNGd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NQkFmOHdEUVlKS29aSWh2Y05BUUVGQlFB
33
+ RGdZRUFvb0VleFAvb1BhbTFUUDcxU3l1aHhNYit1VHJaYlNRZQpqVkIrRXhS
34
+ d1dhZEd3YU5QVUE1NmQzOXF3YXZ3UCtpdSszSnBlb25OTVZ2YldYRjVuYUNY
35
+ L2RORkllUkVIekVSClpEUlFZTXFydTlURU1uYTZIRDl6cGNzdEY3dndUaEdv
36
+ dmxPUSszWTZwbFE0bk16aXBYY1o5VEhxczY1UElMMHEKZWFid3BDYkFvcG89
37
+ Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
38
+ date: 2012-03-16 00:00:00.000000000 Z
39
+ dependencies: []
40
+ description:
41
+ email: sixarm@sixarm.com
42
+ executables: []
43
+ extensions: []
44
+ extra_rdoc_files: []
45
+ files:
46
+ - .gemtest
47
+ - Rakefile
48
+ - README.md
49
+ - VERSION
50
+ - lib/sixarm_ruby_rexml.rb
51
+ - lib/sixarm_ruby_rexml/attributes.rb
52
+ - lib/sixarm_ruby_rexml/document.rb
53
+ - lib/sixarm_ruby_rexml/element.rb
54
+ - test/sixarm_ruby_rexml_test.rb
55
+ - test/sixarm_ruby_rexml_test/attributes_test.rb
56
+ - test/sixarm_ruby_rexml_test/document_test.rb
57
+ - test/sixarm_ruby_rexml_test/element_test.rb
58
+ homepage: http://sixarm.com/
59
+ licenses: []
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 1.8.11
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: SixArm.com » Ruby » REXML extensions for XML documents, elements, and attributes
82
+ test_files:
83
+ - test/sixarm_ruby_rexml_test.rb
84
+ - test/sixarm_ruby_rexml_test/attributes_test.rb
85
+ - test/sixarm_ruby_rexml_test/document_test.rb
86
+ - test/sixarm_ruby_rexml_test/element_test.rb
87
+ has_rdoc: true
metadata.gz.sig ADDED
Binary file