roxml 2.5.1 → 2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Manifest.txt +0 -1
- data/README.rdoc +12 -2
- data/lib/roxml.rb +20 -9
- data/lib/roxml/definition.rb +3 -3
- data/lib/roxml/extensions.rb +4 -1
- data/lib/roxml/xml/references.rb +3 -2
- data/roxml.gemspec +4 -4
- data/test/bugs/rexml_bugs.rb +1 -1
- data/test/test_helper.rb +1 -0
- data/test/unit/definition_test.rb +2 -2
- data/test/unit/deprecations_test.rb +1 -1
- data/test/unit/to_xml_test.rb +5 -5
- data/test/unit/xml_attribute_test.rb +1 -1
- data/test/unit/xml_block_test.rb +1 -1
- data/test/unit/xml_bool_test.rb +1 -1
- data/test/unit/xml_construct_test.rb +1 -1
- data/test/unit/xml_convention_test.rb +1 -1
- data/test/unit/xml_hash_test.rb +1 -1
- data/test/unit/xml_initialize_test.rb +1 -1
- data/test/unit/xml_name_test.rb +1 -1
- data/test/unit/xml_namespace_test.rb +2 -2
- data/test/unit/xml_object_test.rb +1 -1
- data/test/unit/xml_required_test.rb +1 -1
- data/test/unit/xml_text_test.rb +1 -1
- metadata +2 -3
- data/lib/roxml/extensions/active_support.rb +0 -54
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 2.5.2 (March 12, 2009)
|
2
|
+
|
3
|
+
* minor enhancements
|
4
|
+
|
5
|
+
* Remove dependency on an Object#try which conflicted with ActiveSupport 2.3's version
|
6
|
+
* Document the :to_xml option for attr references
|
7
|
+
* Require active_support directly, as it's less brittle and plays nicer with other libraries
|
8
|
+
|
1
9
|
== 2.5.1 (March 2, 2009)
|
2
10
|
|
3
11
|
* minor enhancements
|
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
|
-
ROXML Ruby Object to XML mapping library.
|
2
|
-
|
1
|
+
ROXML Ruby Object to XML mapping library.
|
2
|
+
|
3
|
+
For more information visit:
|
4
|
+
|
5
|
+
http://roxml.rubyforge.org/rdoc/
|
6
|
+
http://empact.github.com/roxml/
|
7
|
+
http://rubyforge.org/projects/roxml/
|
8
|
+
|
9
|
+
Progress on this project is (more or less) tracked at:
|
10
|
+
|
11
|
+
http://www.pivotaltracker.com/project/4109
|
12
|
+
|
3
13
|
|
4
14
|
=Quick Start Guide
|
5
15
|
|
data/lib/roxml.rb
CHANGED
@@ -8,7 +8,7 @@ require 'uri'
|
|
8
8
|
end
|
9
9
|
|
10
10
|
module ROXML # :nodoc:
|
11
|
-
VERSION = '2.5.
|
11
|
+
VERSION = '2.5.2'
|
12
12
|
|
13
13
|
def self.included(base) # :nodoc:
|
14
14
|
base.extend ClassMethods::Accessors,
|
@@ -169,13 +169,19 @@ module ROXML # :nodoc:
|
|
169
169
|
# but in this case an underscored version of the name is applied, for convenience.
|
170
170
|
def xml_convention(to_proc_able = nil, &block)
|
171
171
|
raise ArgumentError, "conventions are already set" if @roxml_naming_convention
|
172
|
-
|
173
|
-
|
174
|
-
|
172
|
+
@roxml_naming_convention =
|
173
|
+
if to_proc_able
|
174
|
+
raise ArgumentError, "only one conventions can be set" if block_given?
|
175
|
+
to_proc_able.to_proc
|
176
|
+
elsif block_given?
|
177
|
+
block
|
178
|
+
end
|
175
179
|
end
|
176
180
|
|
177
181
|
def roxml_naming_convention # :nodoc:
|
178
|
-
(@roxml_naming_convention ||
|
182
|
+
(@roxml_naming_convention || begin
|
183
|
+
superclass.roxml_naming_convention if superclass.respond_to?(:roxml_naming_convention)
|
184
|
+
end).freeze
|
179
185
|
end
|
180
186
|
|
181
187
|
# Declares a reference to a certain xml element, whether an attribute, a node,
|
@@ -440,6 +446,7 @@ module ROXML # :nodoc:
|
|
440
446
|
# [:required] If true, throws RequiredElementMissing when the element isn't present
|
441
447
|
# [:frozen] If true, all results are frozen (using #freeze) at parse-time.
|
442
448
|
# [:cdata] True for values which should be input from or output as cdata elements
|
449
|
+
# [:to_xml] this proc is applied to the attributes value outputting the instance via #to_xml
|
443
450
|
#
|
444
451
|
def xml_attr(sym, type_and_or_opts = nil, opts = nil, &block)
|
445
452
|
returning Definition.new(sym, *[type_and_or_opts, opts].compact, &block) do |attr|
|
@@ -526,18 +533,22 @@ module ROXML # :nodoc:
|
|
526
533
|
end
|
527
534
|
|
528
535
|
def roxml_tag_name # :nodoc:
|
529
|
-
@roxml_tag_name ||
|
536
|
+
@roxml_tag_name || begin
|
537
|
+
superclass.roxml_tag_name if superclass.respond_to?(:roxml_tag_name)
|
538
|
+
end
|
530
539
|
end
|
531
540
|
|
532
541
|
def roxml_namespace # :nodoc:
|
533
|
-
@roxml_namespace ||
|
542
|
+
@roxml_namespace || begin
|
543
|
+
superclass.roxml_namespace if superclass.respond_to?(:roxml_namespace)
|
544
|
+
end
|
534
545
|
end
|
535
546
|
|
536
547
|
# Returns array of internal reference objects, such as attributes
|
537
548
|
# and composed XML objects
|
538
549
|
def roxml_attrs
|
539
550
|
@roxml_attrs ||= []
|
540
|
-
(@roxml_attrs + (superclass.
|
551
|
+
(@roxml_attrs + (superclass.respond_to?(:roxml_attrs) ? superclass.roxml_attrs : [])).freeze
|
541
552
|
end
|
542
553
|
|
543
554
|
def tag_refs # :nodoc:
|
@@ -583,7 +594,7 @@ module ROXML # :nodoc:
|
|
583
594
|
? inst.send(setter, value) \
|
584
595
|
: inst.instance_variable_set("@#{attr.variable_name}", value)
|
585
596
|
end
|
586
|
-
inst.
|
597
|
+
inst.send(:after_parse) if inst.respond_to?(:after_parse, true)
|
587
598
|
end
|
588
599
|
end
|
589
600
|
rescue ArgumentError => e
|
data/lib/roxml/definition.rb
CHANGED
@@ -45,7 +45,7 @@ module ROXML
|
|
45
45
|
end
|
46
46
|
|
47
47
|
@type = extract_type(args, opts)
|
48
|
-
if @type.
|
48
|
+
if @type.respond_to?(:xml_name_without_deprecation?) && @type.xml_name_without_deprecation?
|
49
49
|
unless self.class.silence_xml_name_warning?
|
50
50
|
warn "WARNING: As of 2.3, a breaking change has been in the naming of sub-objects. " +
|
51
51
|
"ROXML now considers the xml_name of the sub-object before falling back to the accessor name of the parent. " +
|
@@ -140,7 +140,7 @@ module ROXML
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def self.fetch_bool(value, default)
|
143
|
-
value = value.
|
143
|
+
value = value.to_s.downcase
|
144
144
|
if %w{true yes 1}.include? value
|
145
145
|
true
|
146
146
|
elsif %w{false no 0}.include? value
|
@@ -220,7 +220,7 @@ module ROXML
|
|
220
220
|
as = (block ? :bool_combined : :bool_standalone)
|
221
221
|
end
|
222
222
|
as = self.class.block_shorthands.fetch(as) do
|
223
|
-
unless as.respond_to?(:from_xml) || as.
|
223
|
+
unless as.respond_to?(:from_xml) || (as.respond_to?(:first) && as.first.respond_to?(:from_xml)) || (as.is_a?(Hash) && !(as.keys & [:key, :value]).empty?)
|
224
224
|
ActiveSupport::Deprecation.warn "#{as.inspect} is not a valid type declaration. ROXML will raise in this case in version 3.0" unless as.nil?
|
225
225
|
end
|
226
226
|
nil
|
data/lib/roxml/extensions.rb
CHANGED
data/lib/roxml/xml/references.rb
CHANGED
@@ -48,8 +48,9 @@ module ROXML
|
|
48
48
|
attr_reader :opts
|
49
49
|
|
50
50
|
def conventionize(what)
|
51
|
-
|
52
|
-
|
51
|
+
convention ||= @instance.class.respond_to?(:roxml_naming_convention) && @instance.class.roxml_naming_convention
|
52
|
+
if !what.blank? && convention.respond_to?(:call)
|
53
|
+
URI.unescape(convention.call(URI.escape(what, /\/|::/)))
|
53
54
|
else
|
54
55
|
what
|
55
56
|
end
|
data/roxml.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{roxml}
|
5
|
-
s.version = "2.5.
|
5
|
+
s.version = "2.5.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ben Woosley", "Zak Mandhro", "Anders Engstrom", "Russ Olsen"]
|
9
|
-
s.date = %q{2009-03-
|
9
|
+
s.date = %q{2009-03-12}
|
10
10
|
s.description = %q{ROXML is a Ruby library designed to make it easier for Ruby developers to work with XML. Using simple annotations, it enables Ruby classes to be mapped to XML. ROXML takes care of the marshalling and unmarshalling of mapped attributes so that developers can focus on building first-class Ruby classes. As a result, ROXML simplifies the development of RESTful applications, Web Services, and XML-RPC.}
|
11
11
|
s.email = %q{ben.woosley@gmail.com}
|
12
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
|
13
|
-
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "TODO", "config/website.yml", "examples/active_record.rb", "examples/amazon.rb", "examples/current_weather.rb", "examples/dashed_elements.rb", "examples/library.rb", "examples/posts.rb", "examples/twitter.rb", "examples/xml/active_record.xml", "examples/xml/amazon.xml", "examples/xml/current_weather.xml", "examples/xml/dashed_elements.xml", "examples/xml/posts.xml", "examples/xml/twitter.xml", "lib/roxml.rb", "lib/roxml/definition.rb", "lib/roxml/extensions.rb", "lib/roxml/extensions/
|
13
|
+
s.files = ["History.txt", "MIT-LICENSE", "Manifest.txt", "README.rdoc", "Rakefile", "TODO", "config/website.yml", "examples/active_record.rb", "examples/amazon.rb", "examples/current_weather.rb", "examples/dashed_elements.rb", "examples/library.rb", "examples/posts.rb", "examples/twitter.rb", "examples/xml/active_record.xml", "examples/xml/amazon.xml", "examples/xml/current_weather.xml", "examples/xml/dashed_elements.xml", "examples/xml/posts.xml", "examples/xml/twitter.xml", "lib/roxml.rb", "lib/roxml/definition.rb", "lib/roxml/extensions.rb", "lib/roxml/extensions/array.rb", "lib/roxml/extensions/array/conversions.rb", "lib/roxml/extensions/deprecation.rb", "lib/roxml/extensions/string.rb", "lib/roxml/extensions/string/conversions.rb", "lib/roxml/extensions/string/iterators.rb", "lib/roxml/hash_definition.rb", "lib/roxml/xml.rb", "lib/roxml/xml/parsers/libxml.rb", "lib/roxml/xml/parsers/rexml.rb", "lib/roxml/xml/references.rb", "roxml.gemspec", "spec/definition_spec.rb", "spec/examples/active_record_spec.rb", "spec/examples/amazon_spec.rb", "spec/examples/current_weather_spec.rb", "spec/examples/dashed_elements_spec.rb", "spec/examples/library_spec.rb", "spec/examples/post_spec.rb", "spec/examples/twitter_spec.rb", "spec/roxml_spec.rb", "spec/shared_specs.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/string_spec.rb", "spec/xml/parser_spec.rb", "tasks/rspec.rake", "tasks/test.rake", "test/bugs/rexml_bugs.rb", "test/fixtures/book_malformed.xml", "test/fixtures/book_pair.xml", "test/fixtures/book_text_with_attribute.xml", "test/fixtures/book_valid.xml", "test/fixtures/book_with_authors.xml", "test/fixtures/book_with_contributions.xml", "test/fixtures/book_with_contributors.xml", "test/fixtures/book_with_contributors_attrs.xml", "test/fixtures/book_with_default_namespace.xml", "test/fixtures/book_with_depth.xml", "test/fixtures/book_with_octal_pages.xml", "test/fixtures/book_with_publisher.xml", "test/fixtures/book_with_wrapped_attr.xml", "test/fixtures/dictionary_of_attr_name_clashes.xml", "test/fixtures/dictionary_of_attrs.xml", "test/fixtures/dictionary_of_guarded_names.xml", "test/fixtures/dictionary_of_mixeds.xml", "test/fixtures/dictionary_of_name_clashes.xml", "test/fixtures/dictionary_of_names.xml", "test/fixtures/dictionary_of_texts.xml", "test/fixtures/library.xml", "test/fixtures/library_uppercase.xml", "test/fixtures/muffins.xml", "test/fixtures/nameless_ageless_youth.xml", "test/fixtures/node_with_attr_name_conflicts.xml", "test/fixtures/node_with_name_conflicts.xml", "test/fixtures/numerology.xml", "test/fixtures/person.xml", "test/fixtures/person_with_guarded_mothers.xml", "test/fixtures/person_with_mothers.xml", "test/mocks/dictionaries.rb", "test/mocks/mocks.rb", "test/release/dependencies_test.rb", "test/test_helper.rb", "test/unit/definition_test.rb", "test/unit/deprecations_test.rb", "test/unit/to_xml_test.rb", "test/unit/xml_attribute_test.rb", "test/unit/xml_block_test.rb", "test/unit/xml_bool_test.rb", "test/unit/xml_construct_test.rb", "test/unit/xml_convention_test.rb", "test/unit/xml_hash_test.rb", "test/unit/xml_initialize_test.rb", "test/unit/xml_name_test.rb", "test/unit/xml_namespace_test.rb", "test/unit/xml_object_test.rb", "test/unit/xml_required_test.rb", "test/unit/xml_text_test.rb", "vendor/override_rake_task/README", "vendor/override_rake_task/init.rb", "vendor/override_rake_task/install.rb", "vendor/override_rake_task/lib/override_rake_task.rb", "website/index.html"]
|
14
14
|
s.has_rdoc = true
|
15
15
|
s.homepage = %q{http://roxml.rubyforge.org}
|
16
16
|
s.rdoc_options = ["--main", "README.rdoc"]
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.rubyforge_project = %q{roxml}
|
19
19
|
s.rubygems_version = %q{1.3.1}
|
20
20
|
s.summary = %q{Ruby Object to XML mapping library}
|
21
|
-
s.test_files = ["test/unit/
|
21
|
+
s.test_files = ["test/unit/xml_convention_test.rb", "test/unit/xml_object_test.rb", "test/unit/xml_required_test.rb", "test/unit/xml_bool_test.rb", "test/unit/xml_name_test.rb", "test/unit/definition_test.rb", "test/unit/xml_construct_test.rb", "test/unit/xml_namespace_test.rb", "test/unit/deprecations_test.rb", "test/unit/xml_text_test.rb", "test/unit/xml_block_test.rb", "test/unit/xml_attribute_test.rb", "test/unit/xml_initialize_test.rb", "test/unit/xml_hash_test.rb", "test/unit/to_xml_test.rb"]
|
22
22
|
|
23
23
|
if s.respond_to? :specification_version then
|
24
24
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
data/test/bugs/rexml_bugs.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
2
|
|
3
|
-
class RexmlBugs <
|
3
|
+
class RexmlBugs < ActiveSupport::TestCase
|
4
4
|
def test_that_some_illegal_chars_are_parsed_without_complaint
|
5
5
|
p "REXML ignores illegal ']]>' brackets in xml content"
|
6
6
|
assert_nothing_raised do
|
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
2
|
|
3
|
-
class TestDefinition <
|
3
|
+
class TestDefinition < ActiveSupport::TestCase
|
4
4
|
def assert_hash(opts, kvp)
|
5
5
|
assert opts.hash?
|
6
6
|
assert !opts.array?
|
@@ -300,7 +300,7 @@ class RoxmlObject
|
|
300
300
|
include ROXML
|
301
301
|
end
|
302
302
|
|
303
|
-
class HashDefinitionTest <
|
303
|
+
class HashDefinitionTest < ActiveSupport::TestCase
|
304
304
|
def test_content_detected_as_from
|
305
305
|
opts = ROXML::Definition.new(:hash, {:key => :content, :value => :name})
|
306
306
|
assert_equal '.', opts.hash.key.name
|
data/test/unit/to_xml_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
2
|
|
3
|
-
class TestHashToXml <
|
3
|
+
class TestHashToXml < ActiveSupport::TestCase
|
4
4
|
to_xml_test :dictionary_of_attrs,
|
5
5
|
:dictionary_of_mixeds,
|
6
6
|
:dictionary_of_texts,
|
@@ -10,7 +10,7 @@ class TestHashToXml < Test::Unit::TestCase
|
|
10
10
|
:dictionary_of_attr_name_clashes
|
11
11
|
end
|
12
12
|
|
13
|
-
class TestOtherToXml <
|
13
|
+
class TestOtherToXml < ActiveSupport::TestCase
|
14
14
|
to_xml_test :book => :book_valid,
|
15
15
|
:book_with_author_text_attribute => :book_text_with_attribute,
|
16
16
|
:uppercase_library => :library_uppercase
|
@@ -28,7 +28,7 @@ class TestOtherToXml < Test::Unit::TestCase
|
|
28
28
|
to_xml_test :book_with_wrapped_attr
|
29
29
|
end
|
30
30
|
|
31
|
-
class TestToXmlWithDefaults <
|
31
|
+
class TestToXmlWithDefaults < ActiveSupport::TestCase
|
32
32
|
def test_content_and_attr_defaults_are_represented_in_output
|
33
33
|
dict = Person.from_xml(fixture(:nameless_ageless_youth))
|
34
34
|
|
@@ -37,7 +37,7 @@ class TestToXmlWithDefaults < Test::Unit::TestCase
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
class TestToXmlWithBlocks <
|
40
|
+
class TestToXmlWithBlocks < ActiveSupport::TestCase
|
41
41
|
def test_pagecount_serialized_properly_after_modification
|
42
42
|
b = Book.from_xml(fixture(:book_valid))
|
43
43
|
xml = xml_fixture(:book_valid)
|
@@ -76,6 +76,6 @@ class BookWithOctalPages
|
|
76
76
|
xml_accessor :pages_with_type, OctalInteger, :required => true
|
77
77
|
end
|
78
78
|
|
79
|
-
class TestToXmlWithOverriddenOutput <
|
79
|
+
class TestToXmlWithOverriddenOutput < ActiveSupport::TestCase
|
80
80
|
to_xml_test :book_with_octal_pages
|
81
81
|
end
|
data/test/unit/xml_block_test.rb
CHANGED
data/test/unit/xml_bool_test.rb
CHANGED
@@ -36,7 +36,7 @@ class InheritedBookWithDepthWithXmlConstruct < Book
|
|
36
36
|
xml_reader :depth, MeasurementWithXmlConstruct
|
37
37
|
end
|
38
38
|
|
39
|
-
class TestXMLConstruct <
|
39
|
+
class TestXMLConstruct < ActiveSupport::TestCase
|
40
40
|
def test_is_deprecated
|
41
41
|
assert_deprecated do
|
42
42
|
MeasurementWithXmlConstruct.xml_construction_args
|
@@ -94,7 +94,7 @@ end
|
|
94
94
|
class InheritedBookCaseDefault < ParentBookCaseDefault
|
95
95
|
end
|
96
96
|
|
97
|
-
class
|
97
|
+
class TestXMLConvention < ActiveSupport::TestCase
|
98
98
|
# TODO: Test convention applies to xml_name as well...
|
99
99
|
|
100
100
|
def test_default_convention_is_underscore
|
data/test/unit/xml_hash_test.rb
CHANGED
@@ -7,7 +7,7 @@ class BookWithContributorHash
|
|
7
7
|
:value => 'name'}
|
8
8
|
end
|
9
9
|
|
10
|
-
class TestXMLHash <
|
10
|
+
class TestXMLHash < ActiveSupport::TestCase
|
11
11
|
def setup
|
12
12
|
@contents = {'quaquaversally' => 'adjective: (of a geological formation) sloping downward from the center in all directions.',
|
13
13
|
'tergiversate' => 'To use evasions or ambiguities; equivocate.'}
|
@@ -13,7 +13,7 @@ class BookWithXmlInitialize < BookWithDepth
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
class TestXMLInitialize <
|
16
|
+
class TestXMLInitialize < ActiveSupport::TestCase
|
17
17
|
def test_xml_construct_not_in_use
|
18
18
|
assert Measurement.xml_construction_args_without_deprecation.empty?
|
19
19
|
end
|
data/test/unit/xml_name_test.rb
CHANGED
@@ -48,7 +48,7 @@ class ParentOfUnnamedChildWithFrom
|
|
48
48
|
xml_accessor :child_accessor_name, Child, :from => 'child_from_name'
|
49
49
|
end
|
50
50
|
|
51
|
-
class TestXMLName <
|
51
|
+
class TestXMLName < ActiveSupport::TestCase
|
52
52
|
def test_from_always_dominates_attribute_name_xml_name_or_not
|
53
53
|
parent = ParentOfNamedChildWithFrom.new
|
54
54
|
parent.child_accessor_name = Child.new
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
2
|
|
3
|
-
class TestDefaultXMLNamespaces <
|
3
|
+
class TestDefaultXMLNamespaces < ActiveSupport::TestCase
|
4
4
|
def setup
|
5
5
|
@book = BookWithContributions.from_xml(fixture(:book_with_default_namespace))
|
6
6
|
end
|
@@ -47,7 +47,7 @@ class NamespaceyObject
|
|
47
47
|
xml_reader :no_namespace, :from => 'no_namespace'
|
48
48
|
end
|
49
49
|
|
50
|
-
class TestXMLNamespaceDeclarations <
|
50
|
+
class TestXMLNamespaceDeclarations < ActiveSupport::TestCase
|
51
51
|
def setup
|
52
52
|
@instance = NamespaceyObject.from_xml(%{
|
53
53
|
<aws:book xmlns:aws="http://www.aws.com/aws" xmlns:different="http://www.aws.com/different">
|
@@ -16,7 +16,7 @@ class CartHolder
|
|
16
16
|
xml_reader :cart, EmptyCart, :required => true
|
17
17
|
end
|
18
18
|
|
19
|
-
class TestXMLObject <
|
19
|
+
class TestXMLObject < ActiveSupport::TestCase
|
20
20
|
# Test book with text and attribute
|
21
21
|
def test_book_author_text_attribute
|
22
22
|
book = BookWithAuthorTextAttribute.from_xml(fixture(:book_text_with_attribute))
|
data/test/unit/xml_text_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
2
|
|
3
|
-
class TestXMLText <
|
3
|
+
class TestXMLText < ActiveSupport::TestCase
|
4
4
|
# Test a simple mapping with no composition
|
5
5
|
def test_valid_simple
|
6
6
|
book = Book.from_xml(fixture(:book_valid))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Woosley
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2009-03-
|
15
|
+
date: 2009-03-12 00:00:00 -04:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -109,7 +109,6 @@ files:
|
|
109
109
|
- lib/roxml.rb
|
110
110
|
- lib/roxml/definition.rb
|
111
111
|
- lib/roxml/extensions.rb
|
112
|
-
- lib/roxml/extensions/active_support.rb
|
113
112
|
- lib/roxml/extensions/array.rb
|
114
113
|
- lib/roxml/extensions/array/conversions.rb
|
115
114
|
- lib/roxml/extensions/deprecation.rb
|
@@ -1,54 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'active_support/core_ext/symbol'
|
3
|
-
require 'active_support/core_ext/blank'
|
4
|
-
require 'active_support/core_ext/duplicable'
|
5
|
-
require 'active_support/core_ext/array/extract_options'
|
6
|
-
|
7
|
-
class Array #:nodoc:
|
8
|
-
include ActiveSupport::CoreExtensions::Array::ExtractOptions
|
9
|
-
end
|
10
|
-
|
11
|
-
require 'active_support/core_ext/hash/reverse_merge'
|
12
|
-
require 'active_support/core_ext/module/delegation'
|
13
|
-
require 'active_support/core_ext/module/aliasing'
|
14
|
-
require 'active_support/core_ext/module/attribute_accessors'
|
15
|
-
require 'active_support/core_ext/object/misc' # returning
|
16
|
-
require 'active_support/inflector'
|
17
|
-
require 'active_support/multibyte'
|
18
|
-
require 'active_support/core_ext/string'
|
19
|
-
class String
|
20
|
-
# This conflicts with builder, unless builder is required first, which we don't want to force on people
|
21
|
-
undef_method :to_xs if method_defined?(:to_xs)
|
22
|
-
end
|
23
|
-
|
24
|
-
class Module #:nodoc:
|
25
|
-
include ActiveSupport::CoreExtensions::Module if ActiveSupport::CoreExtensions.const_defined? :Module
|
26
|
-
end
|
27
|
-
|
28
|
-
class Hash #:nodoc:
|
29
|
-
include ActiveSupport::CoreExtensions::Hash::ReverseMerge
|
30
|
-
end
|
31
|
-
|
32
|
-
class Object #:nodoc:
|
33
|
-
unless method_defined?(:try)
|
34
|
-
# Taken from the upcoming ActiveSupport 2.3
|
35
|
-
#
|
36
|
-
# Tries to send the method only if object responds to it. Return +nil+ otherwise.
|
37
|
-
# It will also forward any arguments and/or block like Object#send does.
|
38
|
-
#
|
39
|
-
# ==== Example :
|
40
|
-
#
|
41
|
-
# # Without try
|
42
|
-
# @person ? @person.name : nil
|
43
|
-
#
|
44
|
-
# With try
|
45
|
-
# @person.try(:name)
|
46
|
-
#
|
47
|
-
# # try also accepts arguments/blocks for the method it is trying
|
48
|
-
# Person.try(:find, 1)
|
49
|
-
# @people.try(:map) {|p| p.name}
|
50
|
-
def try(method, *args, &block)
|
51
|
-
send(method, *args, &block) if respond_to?(method, true)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|