roxml 2.4.1 → 2.4.2
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/History.txt +21 -0
- data/MIT-LICENSE +1 -1
- data/Manifest.txt +27 -6
- data/Rakefile +2 -2
- data/TODO +35 -14
- data/config/website.yml +2 -0
- data/examples/amazon.rb +33 -0
- data/examples/current_weather.rb +27 -0
- data/examples/dashed_elements.rb +20 -0
- data/examples/posts.rb +27 -0
- data/examples/twitter.rb +37 -0
- data/examples/xml/amazon.xml +133 -0
- data/examples/xml/current_weather.xml +89 -0
- data/examples/xml/dashed_elements.xml +52 -0
- data/examples/xml/posts.xml +23 -0
- data/examples/xml/twitter.xml +422 -0
- data/lib/roxml.rb +35 -6
- data/lib/roxml/{options.rb → definition.rb} +60 -88
- data/lib/roxml/extensions.rb +3 -0
- data/lib/roxml/hash_definition.rb +59 -0
- data/lib/roxml/xml.rb +15 -272
- data/lib/roxml/xml/{libxml.rb → parsers/libxml.rb} +13 -5
- data/lib/roxml/xml/{rexml.rb → parsers/rexml.rb} +13 -4
- data/lib/roxml/xml/references.rb +290 -0
- data/roxml.gemspec +4 -4
- data/spec/examples/amazon_spec.rb +53 -0
- data/spec/examples/current_weather_spec.rb +37 -0
- data/spec/examples/dashed_elements_spec.rb +20 -0
- data/spec/examples/post_spec.rb +24 -0
- data/spec/examples/twitter_spec.rb +32 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +16 -0
- data/tasks/rspec.rake +21 -0
- data/test/unit/definition_test.rb +160 -0
- data/test/unit/inheritance_test.rb +22 -1
- data/test/unit/roxml_test.rb +30 -1
- data/test/unit/xml_name_test.rb +29 -0
- data/test/unit/xml_namespace_test.rb +38 -1
- data/website/index.html +98 -0
- metadata +30 -9
- data/html/index.html +0 -278
- data/html/style.css +0 -79
- data/test/unit/options_test.rb +0 -103
data/html/style.css
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
/* Generated by CaScadeS, a stylesheet editor for Mozilla Composer */
|
2
|
-
|
3
|
-
body { margin: 0px;
|
4
|
-
font-size: 13px;
|
5
|
-
font-family: arial,sans-serif;
|
6
|
-
background: #DDD;
|
7
|
-
}
|
8
|
-
|
9
|
-
.highlight {
|
10
|
-
background: #FFD;
|
11
|
-
}
|
12
|
-
.contentBlock {
|
13
|
-
margin-left: 50px;
|
14
|
-
margin-top: 2px;
|
15
|
-
background: #FEFEFE;
|
16
|
-
width: 700px; padding: 10px;
|
17
|
-
border-left: solid 2px #FFF;
|
18
|
-
border-right: solid 2px #AAA;
|
19
|
-
}
|
20
|
-
|
21
|
-
.quickLinks { text-align: center;
|
22
|
-
margin-left: 50px;
|
23
|
-
padding-left: 10px; padding-right: 10px;
|
24
|
-
padding-top: 3px; padding-bottom: 3px;
|
25
|
-
margin-top: 2px;
|
26
|
-
border-left: solid 2px #FFF;
|
27
|
-
border-right: solid 2px #AAA;
|
28
|
-
background: white;
|
29
|
-
width: 700px;
|
30
|
-
}
|
31
|
-
|
32
|
-
.quickLinks a { padding-left: 5px;
|
33
|
-
padding-right: 5px;
|
34
|
-
text-decoration: underline;
|
35
|
-
}
|
36
|
-
|
37
|
-
.quickLinks a:hover {
|
38
|
-
background: #EEE;
|
39
|
-
}
|
40
|
-
|
41
|
-
a { text-decoration: none;
|
42
|
-
}
|
43
|
-
|
44
|
-
a:hover { }
|
45
|
-
|
46
|
-
code { font-size: 12px;
|
47
|
-
font-family: monospace;
|
48
|
-
}
|
49
|
-
|
50
|
-
pre { border: 1px solid rgb(221, 221, 221);
|
51
|
-
padding: 1em;
|
52
|
-
overflow: auto;
|
53
|
-
width: 70%;
|
54
|
-
background-color: rgb(238, 238, 238);
|
55
|
-
color: rgb(0, 0, 0);
|
56
|
-
}
|
57
|
-
|
58
|
-
h1 {
|
59
|
-
text-align: center;
|
60
|
-
font-size: 150%;
|
61
|
-
}
|
62
|
-
|
63
|
-
h2 { border-bottom: 1px solid rgb(221, 221, 221);
|
64
|
-
font-size: 150%;
|
65
|
-
}
|
66
|
-
|
67
|
-
h3 { font-size: 120%;
|
68
|
-
}
|
69
|
-
|
70
|
-
#footer { border-top: 1px dashed gray;
|
71
|
-
background-color: rgb(240, 240, 240);
|
72
|
-
font-size: x-small;
|
73
|
-
}
|
74
|
-
|
75
|
-
div#cvs_id { text-align: right;
|
76
|
-
color: rgb(204, 204, 204);
|
77
|
-
font-size: 75%;
|
78
|
-
}
|
79
|
-
|
data/test/unit/options_test.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
2
|
-
|
3
|
-
class TestOptions < Test::Unit::TestCase
|
4
|
-
def assert_hash(opts, kvp)
|
5
|
-
assert opts.hash?
|
6
|
-
assert !opts.array?
|
7
|
-
assert_equal kvp, {opts.hash.key.type => opts.hash.key.name,
|
8
|
-
opts.hash.value.type => opts.hash.value.name}
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_text_in_array_means_as_array_for_text
|
12
|
-
opts = ROXML::Opts.new(:authors, [:text])
|
13
|
-
assert opts.array?
|
14
|
-
assert_equal :text, opts.type
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_attr_in_array_means_as_array_for_attr
|
18
|
-
opts = ROXML::Opts.new(:authors, [:attr])
|
19
|
-
assert opts.array?
|
20
|
-
assert_equal :attr, opts.type
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_object_in_array_means_as_array_for_object
|
24
|
-
opts = ROXML::Opts.new(:authors, [Hash])
|
25
|
-
assert opts.array?
|
26
|
-
assert_equal Hash, opts.type
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_content_is_a_recognized_type
|
30
|
-
assert ROXML::Opts.new(:author, :content).content?
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_required
|
34
|
-
assert !ROXML::Opts.new(:author, :content).required?
|
35
|
-
assert ROXML::Opts.new(:author, :content, :required => true).required?
|
36
|
-
assert !ROXML::Opts.new(:author, :content, :required => false).required?
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_required_conflicts_with_else
|
40
|
-
assert_raise ArgumentError do
|
41
|
-
ROXML::Opts.new(:author, :content, :required => true, :else => 'Johnny')
|
42
|
-
end
|
43
|
-
assert_nothing_raised do
|
44
|
-
ROXML::Opts.new(:author, :content, :required => false, :else => 'Johnny')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_hash_of_attrs
|
49
|
-
opts = ROXML::Opts.new(:attributes, {:attrs => [:name, :value]})
|
50
|
-
assert_hash(opts, :attr => 'name', :attr => 'value')
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_hash_with_attr_key_and_text_val
|
54
|
-
opts = ROXML::Opts.new(:attributes, {:key => {:attr => :name},
|
55
|
-
:value => :value})
|
56
|
-
assert_hash(opts, :attr => 'name', :text => 'value')
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_hash_with_string_class_for_type
|
60
|
-
opts = ROXML::Opts.new(:attributes, {:key => {String => 'name'},
|
61
|
-
:value => {String => 'value'}})
|
62
|
-
assert_hash(opts, :text => 'name', :text => 'value')
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_hash_with_attr_key_and_content_val
|
66
|
-
opts = ROXML::Opts.new(:attributes, {:key => {:attr => :name},
|
67
|
-
:value => :content})
|
68
|
-
assert_hash(opts, :attr => 'name', :content => '')
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_hash_with_options
|
72
|
-
opts = ROXML::Opts.new(:definitions, {:attrs => [:dt, :dd]},
|
73
|
-
:in => :definitions)
|
74
|
-
assert_hash(opts, :attr => 'dt', :attr => 'dd')
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_no_block_shorthand_means_no_block
|
78
|
-
assert ROXML::Opts.new(:count).blocks.empty?
|
79
|
-
assert ROXML::Opts.new(:count, :as => :intager).blocks.empty?
|
80
|
-
assert ROXML::Opts.new(:count, :as => :foat).blocks.empty?
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_block_integer_shorthand
|
84
|
-
assert_equal 3, ROXML::Opts.new(:count, :as => :integer).blocks.first['3']
|
85
|
-
assert_equal 3, ROXML::Opts.new(:count, :as => Integer).blocks.first['3']
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_block_float_shorthand
|
89
|
-
assert_equal 3.1, ROXML::Opts.new(:count, :as => :float).blocks.first['3.1']
|
90
|
-
assert_equal 3.1, ROXML::Opts.new(:count, :as => Float).blocks.first['3.1']
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_multiple_shorthands_raises
|
94
|
-
assert_raises ArgumentError do
|
95
|
-
ROXML::Opts.new(:count, :as => [Float, Integer])
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_stacked_blocks
|
100
|
-
assert_equal 2, ROXML::Opts.new(:count, :as => Integer) {|val| val.to_i }.blocks.size
|
101
|
-
assert_equal 2, ROXML::Opts.new(:count, :as => Float) {|val| val.object_id }.blocks.size
|
102
|
-
end
|
103
|
-
end
|