representable 1.8.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/CHANGES.md +6 -0
- data/Gemfile +4 -0
- data/lib/representable/coercion.rb +2 -1
- data/lib/representable/config.rb +1 -1
- data/lib/representable/definition.rb +1 -1
- data/lib/representable/version.rb +1 -1
- data/representable.gemspec +0 -1
- data/test/inline_test.rb +8 -4
- data/test/xml_bindings_test.rb +4 -4
- metadata +64 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c404fc7cc88d164d5e03512e8d112ad44b5b1b1d
|
4
|
+
data.tar.gz: bfef2af61a347c39153f41f62bddf8324bf87026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a45dbbd0995024eedb480cc1c42fe976a7e654275cd93161b3f78745e0701fce278efd5e7a998dac9b6c81cc31d8587f7ac034581e6f21687802103de963bdb
|
7
|
+
data.tar.gz: 5be6553990c8e27590d39f83ca171cb8fb96983f028d5a8d8a28817218ab05d7309da0295f8d188a4f579930d3fb52bcd596b6b9288ba71d26333682933bfb5b
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -2,7 +2,8 @@ require "virtus"
|
|
2
2
|
|
3
3
|
module Representable::Coercion
|
4
4
|
class Coercer
|
5
|
-
|
5
|
+
virtus_coercer = Virtus.respond_to?(:model) ? Virtus.model : Virtus
|
6
|
+
include virtus_coercer
|
6
7
|
|
7
8
|
def coerce(name, v) # TODO: test me.
|
8
9
|
# set and get the value as i don't know where exactly coercion happens in virtus.
|
data/lib/representable/config.rb
CHANGED
@@ -26,7 +26,7 @@ module Representable
|
|
26
26
|
self
|
27
27
|
end
|
28
28
|
|
29
|
-
private :
|
29
|
+
private :[]= # TODO: re-privatize #default when this is sorted with Rubinius.
|
30
30
|
|
31
31
|
def options # TODO: remove in 2.0.
|
32
32
|
warn "Representable::Definition#option is deprecated, use #[] directly."
|
data/representable.gemspec
CHANGED
@@ -29,6 +29,5 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency "mocha", ">= 0.13.0"
|
30
30
|
s.add_development_dependency "mongoid"
|
31
31
|
s.add_development_dependency "virtus", "~> 0.5.0"
|
32
|
-
s.add_development_dependency "yajl-ruby"
|
33
32
|
s.add_development_dependency "json", '~> 1.7.7'
|
34
33
|
end
|
data/test/inline_test.rb
CHANGED
@@ -19,8 +19,10 @@ class InlineTest < MiniTest::Spec
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
let (:format) { format }
|
23
|
+
|
24
|
+
it { render(request).must_equal_document output }
|
25
|
+
it { parse(request, input).song.name.must_equal "You've Taken Everything"}
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
@@ -42,8 +44,10 @@ class InlineTest < MiniTest::Spec
|
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
45
|
-
|
46
|
-
|
47
|
+
let (:format) { format } # FIXME: why do we have to define this?
|
48
|
+
|
49
|
+
it { render(request).must_equal_document output }
|
50
|
+
it { parse(request, input).songs.first.name.must_equal "You've Taken Everything"}
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
data/test/xml_bindings_test.rb
CHANGED
@@ -26,7 +26,7 @@ class XMLBindingTest < MiniTest::Spec
|
|
26
26
|
describe "PropertyBinding" do
|
27
27
|
describe "with plain text" do
|
28
28
|
before do
|
29
|
-
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song), nil, nil)
|
29
|
+
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song), nil, nil, {:doc => @doc})
|
30
30
|
end
|
31
31
|
|
32
32
|
it "extracts with #read" do
|
@@ -41,7 +41,7 @@ class XMLBindingTest < MiniTest::Spec
|
|
41
41
|
|
42
42
|
describe "with an object" do
|
43
43
|
before do
|
44
|
-
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song, :class => SongWithRepresenter), nil, nil)
|
44
|
+
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song, :class => SongWithRepresenter), nil, nil, {:doc => @doc})
|
45
45
|
end
|
46
46
|
|
47
47
|
it "extracts with #read" do
|
@@ -56,7 +56,7 @@ class XMLBindingTest < MiniTest::Spec
|
|
56
56
|
|
57
57
|
describe "with an object and :extend" do
|
58
58
|
before do
|
59
|
-
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song, :class => Song, :extend => SongRepresenter), nil, nil)
|
59
|
+
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song, :class => Song, :extend => SongRepresenter), nil, nil, {:doc => @doc})
|
60
60
|
end
|
61
61
|
|
62
62
|
it "extracts with #read" do
|
@@ -90,7 +90,7 @@ class XMLBindingTest < MiniTest::Spec
|
|
90
90
|
|
91
91
|
describe "with objects" do
|
92
92
|
before do
|
93
|
-
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song, :collection => true, :class => SongWithRepresenter), nil, nil)
|
93
|
+
@property = Representable::XML::PropertyBinding.new(Representable::Definition.new(:song, :collection => true, :class => SongWithRepresenter), nil, nil, {:doc => @doc})
|
94
94
|
end
|
95
95
|
|
96
96
|
it "extracts with #read" do
|
metadata
CHANGED
@@ -1,167 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: representable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: uber
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: test_xml
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.1.6
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.1.6
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 5.0.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 5.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mocha
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 0.13.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.13.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: mongoid
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: virtus
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.5.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.5.0
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: yajl-ruby
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - '>='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - '>='
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: json
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
|
-
- - ~>
|
143
|
+
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
145
|
version: 1.7.7
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
|
-
- - ~>
|
150
|
+
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: 1.7.7
|
167
153
|
description: Renders and parses JSON/XML/YAML documents from and to Ruby objects.
|
@@ -172,8 +158,8 @@ executables: []
|
|
172
158
|
extensions: []
|
173
159
|
extra_rdoc_files: []
|
174
160
|
files:
|
175
|
-
- .gitignore
|
176
|
-
- .travis.yml
|
161
|
+
- ".gitignore"
|
162
|
+
- ".travis.yml"
|
177
163
|
- CHANGES.md
|
178
164
|
- Gemfile
|
179
165
|
- LICENSE
|
@@ -253,19 +239,55 @@ require_paths:
|
|
253
239
|
- lib
|
254
240
|
required_ruby_version: !ruby/object:Gem::Requirement
|
255
241
|
requirements:
|
256
|
-
- -
|
242
|
+
- - ">="
|
257
243
|
- !ruby/object:Gem::Version
|
258
244
|
version: '0'
|
259
245
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
260
246
|
requirements:
|
261
|
-
- -
|
247
|
+
- - ">="
|
262
248
|
- !ruby/object:Gem::Version
|
263
249
|
version: '0'
|
264
250
|
requirements: []
|
265
251
|
rubyforge_project:
|
266
|
-
rubygems_version: 2.
|
252
|
+
rubygems_version: 2.2.1
|
267
253
|
signing_key:
|
268
254
|
specification_version: 4
|
269
255
|
summary: Renders and parses JSON/XML/YAML documents from and to Ruby objects. Includes
|
270
256
|
plain properties, collections, nesting, coercion and more.
|
271
|
-
test_files:
|
257
|
+
test_files:
|
258
|
+
- test/as_test.rb
|
259
|
+
- test/class_test.rb
|
260
|
+
- test/coercion_test.rb
|
261
|
+
- test/config_test.rb
|
262
|
+
- test/decorator_scope_test.rb
|
263
|
+
- test/decorator_test.rb
|
264
|
+
- test/definition_test.rb
|
265
|
+
- test/example.rb
|
266
|
+
- test/exec_context_test.rb
|
267
|
+
- test/generic_test.rb
|
268
|
+
- test/getter_setter_test.rb
|
269
|
+
- test/hash_bindings_test.rb
|
270
|
+
- test/hash_test.rb
|
271
|
+
- test/if_test.rb
|
272
|
+
- test/inherit_test.rb
|
273
|
+
- test/inheritance_test.rb
|
274
|
+
- test/inline_test.rb
|
275
|
+
- test/instance_test.rb
|
276
|
+
- test/is_representable_test.rb
|
277
|
+
- test/json_test.rb
|
278
|
+
- test/mongoid_test.rb
|
279
|
+
- test/nested_test.rb
|
280
|
+
- test/parse_strategy_test.rb
|
281
|
+
- test/pass_options_test.rb
|
282
|
+
- test/prepare_test.rb
|
283
|
+
- test/reader_writer_test.rb
|
284
|
+
- test/representable_test.rb
|
285
|
+
- test/serialize_deserialize_test.rb
|
286
|
+
- test/stringify_hash_test.rb
|
287
|
+
- test/test_helper.rb
|
288
|
+
- test/test_helper_test.rb
|
289
|
+
- test/wrap_test.rb
|
290
|
+
- test/xml_bindings_test.rb
|
291
|
+
- test/xml_test.rb
|
292
|
+
- test/yaml_test.rb
|
293
|
+
has_rdoc:
|