representable 2.3.0 → 2.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +47 -0
- data/Gemfile +5 -0
- data/README.md +33 -0
- data/lib/representable.rb +60 -73
- data/lib/representable/binding.rb +37 -194
- data/lib/representable/cached.rb +10 -46
- data/lib/representable/coercion.rb +8 -8
- data/lib/representable/config.rb +15 -75
- data/lib/representable/debug.rb +41 -59
- data/lib/representable/declarative.rb +34 -53
- data/lib/representable/decorator.rb +11 -40
- data/lib/representable/definition.rb +14 -15
- data/lib/representable/deprecations.rb +90 -0
- data/lib/representable/deserializer.rb +87 -82
- data/lib/representable/for_collection.rb +5 -3
- data/lib/representable/hash.rb +5 -3
- data/lib/representable/hash/binding.rb +6 -15
- data/lib/representable/hash/collection.rb +10 -6
- data/lib/representable/hash_methods.rb +5 -5
- data/lib/representable/insert.rb +31 -0
- data/lib/representable/json.rb +7 -3
- data/lib/representable/json/hash.rb +1 -1
- data/lib/representable/object/binding.rb +5 -5
- data/lib/representable/parse_strategies.rb +37 -3
- data/lib/representable/pipeline.rb +37 -5
- data/lib/representable/pipeline_factories.rb +88 -0
- data/lib/representable/serializer.rb +38 -44
- data/lib/representable/version.rb +1 -1
- data/lib/representable/xml.rb +4 -0
- data/lib/representable/xml/binding.rb +25 -31
- data/lib/representable/xml/collection.rb +5 -3
- data/lib/representable/xml/hash.rb +7 -2
- data/lib/representable/yaml.rb +6 -3
- data/lib/representable/yaml/binding.rb +4 -4
- data/representable.gemspec +3 -3
- data/test/---deserialize-pipeline_test.rb +37 -0
- data/test/binding_test.rb +7 -7
- data/test/cached_test.rb +31 -19
- data/test/coercion_test.rb +2 -2
- data/test/config/inherit_test.rb +13 -12
- data/test/config_test.rb +12 -67
- data/test/decorator_test.rb +4 -5
- data/test/default_test.rb +34 -0
- data/test/defaults_options_test.rb +93 -0
- data/test/definition_test.rb +19 -39
- data/test/exec_context_test.rb +1 -1
- data/test/filter_test.rb +18 -20
- data/test/getter_setter_test.rb +1 -8
- data/test/hash_bindings_test.rb +13 -13
- data/test/heritage_test.rb +62 -0
- data/test/if_test.rb +1 -0
- data/test/inherit_test.rb +5 -3
- data/test/instance_test.rb +3 -4
- data/test/json_test.rb +3 -59
- data/test/lonely_test.rb +47 -3
- data/test/nested_test.rb +8 -2
- data/test/pipeline_test.rb +259 -0
- data/test/populator_test.rb +76 -0
- data/test/realistic_benchmark.rb +39 -7
- data/test/render_nil_test.rb +21 -0
- data/test/represent_test.rb +2 -2
- data/test/representable_test.rb +33 -103
- data/test/schema_test.rb +5 -15
- data/test/serialize_deserialize_test.rb +2 -2
- data/test/skip_test.rb +1 -1
- data/test/test_helper.rb +6 -0
- data/test/uncategorized_test.rb +67 -0
- data/test/xml_bindings_test.rb +6 -6
- data/test/xml_test.rb +6 -6
- metadata +33 -13
- data/lib/representable/apply.rb +0 -13
- data/lib/representable/inheritable.rb +0 -71
- data/lib/representable/mapper.rb +0 -83
- data/lib/representable/populator.rb +0 -56
- data/test/inheritable_test.rb +0 -97
data/test/represent_test.rb
CHANGED
@@ -6,7 +6,7 @@ class RepresentTest < MiniTest::Spec
|
|
6
6
|
|
7
7
|
for_formats(
|
8
8
|
:hash => [Representable::Hash, out=[{"name" => "Days Go By"}, {"name"=>"Can't Take Them All"}], out],
|
9
|
-
:json => [Representable::JSON, out="[{\"name\":\"Days Go By\"},{\"name\":\"Can't Take Them All\"}]", out],
|
9
|
+
# :json => [Representable::JSON, out="[{\"name\":\"Days Go By\"},{\"name\":\"Can't Take Them All\"}]", out],
|
10
10
|
# :xml => [Representable::XML, out="<a><song></song><song></song></a>", out]
|
11
11
|
) do |format, mod, output, input|
|
12
12
|
|
@@ -40,7 +40,7 @@ class RepresentTest < MiniTest::Spec
|
|
40
40
|
}
|
41
41
|
|
42
42
|
it { render(representer.represent(songs)).must_equal_document output }
|
43
|
-
it { parse(representer.represent([]), input).must_equal songs }
|
43
|
+
it("ficken") { parse(representer.represent([]), input).must_equal songs }
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
data/test/representable_test.rb
CHANGED
@@ -281,39 +281,48 @@ class RepresentableTest < MiniTest::Spec
|
|
281
281
|
end
|
282
282
|
|
283
283
|
describe "passing options" do
|
284
|
-
class Track
|
285
|
-
attr_accessor :nr
|
286
|
-
end
|
287
|
-
|
288
284
|
module TrackRepresenter
|
289
285
|
include Representable::Hash
|
290
|
-
property :nr
|
291
286
|
|
292
|
-
def to_hash(options)
|
293
|
-
@nr = options[:nr]
|
294
|
-
super
|
295
|
-
end
|
296
|
-
def from_hash(data, options)
|
297
|
-
super.tap do
|
298
|
-
@nr = options[:nr]
|
299
|
-
end
|
300
|
-
end
|
301
287
|
end
|
302
288
|
|
303
289
|
representer! do
|
304
|
-
property :track, :
|
305
|
-
|
290
|
+
property :track, class: OpenStruct do
|
291
|
+
property :nr
|
292
|
+
|
293
|
+
property :length, class: OpenStruct do
|
294
|
+
def to_hash(options)
|
295
|
+
{seconds: options[:nr]}
|
296
|
+
end
|
297
|
+
|
298
|
+
def from_hash(hash, options)
|
299
|
+
super.tap do
|
300
|
+
self.seconds = options[:nr]
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
306
304
|
|
307
|
-
|
308
|
-
|
309
|
-
|
305
|
+
def to_hash(options)
|
306
|
+
super.merge({"nr" => options[:nr]})
|
307
|
+
end
|
308
|
+
|
309
|
+
def from_hash(data, options)
|
310
|
+
super.tap do
|
311
|
+
self.nr = options[:nr]
|
312
|
+
end
|
313
|
+
end
|
310
314
|
end
|
311
315
|
end
|
312
316
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
+
it "#to_hash propagates to nested objects" do
|
318
|
+
OpenStruct.new(track: OpenStruct.new(nr: 1, length: OpenStruct.new(seconds: nil))).extend(representer).extend(Representable::Debug).
|
319
|
+
to_hash(nr: 9).must_equal({"track"=>{"nr"=>9, "length"=>{seconds: 9}}})
|
320
|
+
end
|
321
|
+
|
322
|
+
it "#from_hash propagates to nested objects" do
|
323
|
+
song = OpenStruct.new.extend(representer).from_hash({"track"=>{"nr" => "replace me", "length"=>{"seconds"=>"replacing"}}}, :nr => 9)
|
324
|
+
song.track.nr.must_equal 9
|
325
|
+
song.track.length.seconds.must_equal 9
|
317
326
|
end
|
318
327
|
end
|
319
328
|
end
|
@@ -358,34 +367,6 @@ class RepresentableTest < MiniTest::Spec
|
|
358
367
|
assert_equal({"name"=>"No One's Choice","groupies"=>false}, @band.to_hash)
|
359
368
|
end
|
360
369
|
|
361
|
-
describe "when :render_nil is true" do
|
362
|
-
it "includes nil attribute" do
|
363
|
-
mod = Module.new do
|
364
|
-
include Representable::JSON
|
365
|
-
property :name
|
366
|
-
property :groupies, :render_nil => true
|
367
|
-
end
|
368
|
-
|
369
|
-
@band.extend(mod) # FIXME: use clean object.
|
370
|
-
@band.groupies = nil
|
371
|
-
hash = @band.to_hash
|
372
|
-
assert_equal({"name"=>"No One's Choice", "groupies" => nil}, hash)
|
373
|
-
end
|
374
|
-
|
375
|
-
it "includes nil attribute without extending" do
|
376
|
-
mod = Module.new do
|
377
|
-
include Representable::JSON
|
378
|
-
property :name
|
379
|
-
property :groupies, :render_nil => true, :extend => BandRepresentation
|
380
|
-
end
|
381
|
-
|
382
|
-
@band.extend(mod) # FIXME: use clean object.
|
383
|
-
@band.groupies = nil
|
384
|
-
hash = @band.to_hash
|
385
|
-
assert_equal({"name"=>"No One's Choice", "groupies" => nil}, hash)
|
386
|
-
end
|
387
|
-
end
|
388
|
-
|
389
370
|
it "does not propagate private options to nested objects" do
|
390
371
|
cover_rpr = Module.new do
|
391
372
|
include Representable::Hash
|
@@ -519,7 +500,7 @@ class RepresentableTest < MiniTest::Spec
|
|
519
500
|
representer! do
|
520
501
|
class MyBinding < Representable::Binding
|
521
502
|
def write(doc, *args)
|
522
|
-
doc[:title] =
|
503
|
+
doc[:title] = represented.title
|
523
504
|
end
|
524
505
|
end
|
525
506
|
property :title, :binding => lambda { |*args| MyBinding.new(*args) }
|
@@ -563,55 +544,4 @@ class RepresentableTest < MiniTest::Spec
|
|
563
544
|
end
|
564
545
|
end
|
565
546
|
end
|
566
|
-
|
567
|
-
|
568
|
-
describe "#use_decorator" do
|
569
|
-
representer! do
|
570
|
-
property :title, :use_decorator => true do
|
571
|
-
property :lower
|
572
|
-
end
|
573
|
-
end
|
574
|
-
|
575
|
-
it "uses a Decorator for inline representer" do
|
576
|
-
outer = Struct.new(:title, :lower, :band, :bla).new(inner = Struct.new(:lower).new("paper wings"))
|
577
|
-
|
578
|
-
outer.extend(representer).to_hash.must_equal({"title"=>{"lower"=>"paper wings"}})
|
579
|
-
outer.must_be_kind_of Representable::Hash
|
580
|
-
inner.wont_be_kind_of Representable::Hash
|
581
|
-
end
|
582
|
-
end
|
583
|
-
|
584
|
-
|
585
|
-
# using your own Definition class
|
586
|
-
class StaticDefinition < Representable::Definition
|
587
|
-
def initialize(name, options)
|
588
|
-
options[:as] = :Name
|
589
|
-
super
|
590
|
-
end
|
591
|
-
end
|
592
|
-
|
593
|
-
|
594
|
-
module StaticRepresenter
|
595
|
-
def self.build_config
|
596
|
-
Representable::Config.new(StaticDefinition)
|
597
|
-
end
|
598
|
-
include Representable::Hash
|
599
|
-
|
600
|
-
property :title
|
601
|
-
end
|
602
|
-
|
603
|
-
# we currently need an intermediate decorator to inherit ::build_config properly.
|
604
|
-
class BaseDecorator < Representable::Decorator
|
605
|
-
include Representable::Hash
|
606
|
-
def self.build_config
|
607
|
-
Representable::Config.new(StaticDefinition)
|
608
|
-
end
|
609
|
-
end
|
610
|
-
|
611
|
-
class StaticDecorator < BaseDecorator
|
612
|
-
property :title
|
613
|
-
end
|
614
|
-
|
615
|
-
it { OpenStruct.new(:title => "Tarutiri").extend(StaticRepresenter).to_hash.must_equal({"Name"=>"Tarutiri"}) }
|
616
|
-
it { StaticDecorator.new(OpenStruct.new(:title => "Tarutiri")).to_hash.must_equal({"Name"=>"Tarutiri"}) }
|
617
547
|
end
|
data/test/schema_test.rb
CHANGED
@@ -109,7 +109,6 @@ class SchemaTest < MiniTest::Spec
|
|
109
109
|
|
110
110
|
|
111
111
|
class InheritFromDecorator < InheritDecorator
|
112
|
-
|
113
112
|
property :label, inherit: true do
|
114
113
|
collection :employees do
|
115
114
|
property :name
|
@@ -117,6 +116,9 @@ class SchemaTest < MiniTest::Spec
|
|
117
116
|
end
|
118
117
|
end
|
119
118
|
|
119
|
+
require "pp"
|
120
|
+
pp InheritFromDecorator.representable_attrs.get(:label)[:extend].(nil).representable_attrs
|
121
|
+
|
120
122
|
it do
|
121
123
|
InheritFromDecorator.new(band).to_hash.must_equal({"genre"=>"Punkrock", "label"=>{"name"=>"Fat Wreck", "city"=>"San Francisco", "employees"=>[{"name"=>"Mike"}], "location"=>{"city"=>"Sanfran"}}})
|
122
124
|
end
|
@@ -125,6 +127,8 @@ end
|
|
125
127
|
|
126
128
|
class ApplyTest < MiniTest::Spec
|
127
129
|
class AlbumDecorator < Representable::Decorator
|
130
|
+
include Representable::Hash
|
131
|
+
|
128
132
|
property :title
|
129
133
|
|
130
134
|
property :hit do
|
@@ -141,18 +145,4 @@ class ApplyTest < MiniTest::Spec
|
|
141
145
|
end
|
142
146
|
end
|
143
147
|
end
|
144
|
-
|
145
|
-
# #apply
|
146
|
-
it do
|
147
|
-
properties = []
|
148
|
-
|
149
|
-
AlbumDecorator.apply do |dfn|
|
150
|
-
properties << dfn.name
|
151
|
-
dfn.merge! :cool => true
|
152
|
-
end.must_equal AlbumDecorator
|
153
|
-
|
154
|
-
properties.must_equal ["title", "hit", "title", "songs", "title", "band", "label", "name"]
|
155
|
-
# writeable
|
156
|
-
AlbumDecorator.representable_attrs.get(:band).representer_module.representable_attrs.get(:label).representer_module.representable_attrs.get(:name)[:cool].must_equal true
|
157
|
-
end
|
158
148
|
end
|
@@ -7,7 +7,7 @@ class SerializeDeserializeTest < BaseTest
|
|
7
7
|
representer! do
|
8
8
|
property :song,
|
9
9
|
:instance => lambda { |fragment, *| fragment.to_s.upcase },
|
10
|
-
:prepare => lambda { |fragment, *| fragment },
|
10
|
+
:prepare => lambda { |fragment, *| fragment },
|
11
11
|
:deserialize => lambda { |object, fragment, args|
|
12
12
|
"#{object} #{fragment} #{args.inspect}"
|
13
13
|
}
|
@@ -20,7 +20,7 @@ class SerializeDeserializeTest < BaseTest
|
|
20
20
|
representer! do
|
21
21
|
property :song,
|
22
22
|
:representable => true,
|
23
|
-
:prepare => lambda { |fragment, *| fragment },
|
23
|
+
:prepare => lambda { |fragment, *| fragment },
|
24
24
|
:serialize => lambda { |object, args|
|
25
25
|
"#{object} #{args.inspect}"
|
26
26
|
}
|
data/test/skip_test.rb
CHANGED
@@ -9,7 +9,7 @@ class SkipParseTest < MiniTest::Spec
|
|
9
9
|
end
|
10
10
|
|
11
11
|
collection :airplays,
|
12
|
-
skip_parse: lambda { |fragment, opts|
|
12
|
+
skip_parse: lambda { |fragment, opts| opts[:skip?] and fragment["station"].nil? }, class: OpenStruct do
|
13
13
|
property :station
|
14
14
|
end
|
15
15
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
require 'representable'
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "psych"
|
5
|
+
|
2
6
|
require 'representable/json'
|
3
7
|
require 'representable/xml'
|
4
8
|
require 'representable/yaml'
|
5
9
|
require 'minitest/autorun'
|
6
10
|
require 'test_xml/mini_test'
|
7
11
|
|
12
|
+
require "representable/debug"
|
13
|
+
|
8
14
|
class Album
|
9
15
|
attr_accessor :songs, :best_song
|
10
16
|
def initialize(songs=nil, best_song=nil)
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class StopWhenIncomingObjectFragmentIsNilTest < MiniTest::Spec
|
4
|
+
Album = Struct.new(:id, :songs)
|
5
|
+
Song = Struct.new(:title)
|
6
|
+
|
7
|
+
representer!(decorator: true) do
|
8
|
+
property :id
|
9
|
+
collection :songs, class: Song, parse_pipeline: ->(input, options) { # TODO: test if :doc is set for parsing. test if options are ok and contain :user_options!
|
10
|
+
Representable::Pipeline[*parse_functions.insert(3, Representable::StopOnNil)]
|
11
|
+
} do
|
12
|
+
property :title
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it do
|
17
|
+
album = Album.new
|
18
|
+
representer.new(album).from_hash({"id"=>1, "songs"=>[{"title"=>"Walkie Talkie"}]}).songs.must_equal [Song.new("Walkie Talkie")]
|
19
|
+
end
|
20
|
+
|
21
|
+
it do
|
22
|
+
album = Album.new(2, ["original"])
|
23
|
+
representer.new(album).from_hash({"id"=>1, "songs"=>nil}).songs.must_equal ["original"]
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
class RenderPipelineOptionTest < MiniTest::Spec
|
29
|
+
Album = Struct.new(:id, :songs)
|
30
|
+
NilToNA = ->(input, options) { input.nil? ? "n/a" : input }
|
31
|
+
|
32
|
+
representer!(decorator: true) do
|
33
|
+
property :id, render_pipeline: ->(input, options) do
|
34
|
+
Representable::Pipeline[*render_functions.insert(2, options[:user_options][:function])]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it { representer.new(Album.new).to_hash(function: NilToNA).must_equal({"id"=>"n/a"}) }
|
39
|
+
it { representer.new(Album.new(1)).to_hash(function: NilToNA).must_equal({"id"=>1}) }
|
40
|
+
|
41
|
+
it "is cached" do
|
42
|
+
decorator = representer.new(Album.new)
|
43
|
+
decorator.to_hash(function: NilToNA).must_equal({"id"=>"n/a"})
|
44
|
+
decorator.to_hash(function: nil).must_equal({"id"=>"n/a"}) # non-sense function is not applied.
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
class ParsePipelineOptionTest < MiniTest::Spec
|
50
|
+
Album = Struct.new(:id, :songs)
|
51
|
+
NilToNA = ->(input, options) { input.nil? ? "n/a" : input }
|
52
|
+
|
53
|
+
representer!(decorator: true) do
|
54
|
+
property :id, parse_pipeline: ->(input, options) do
|
55
|
+
Representable::Pipeline[*parse_functions.insert(3, options[:user_options][:function])].extend(Representable::Pipeline::Debug)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it { representer.new(Album.new).from_hash({"id"=>nil}, function: NilToNA).id.must_equal "n/a" }
|
60
|
+
it { representer.new(Album.new(1)).to_hash(function: NilToNA).must_equal({"id"=>1}) }
|
61
|
+
|
62
|
+
it "is cached" do
|
63
|
+
decorator = representer.new(Album.new)
|
64
|
+
decorator.from_hash({"id"=>nil}, function: NilToNA).id.must_equal "n/a"
|
65
|
+
decorator.from_hash({"id"=>nil}, function: "nonsense").id.must_equal "n/a" # non-sense function is not applied.
|
66
|
+
end
|
67
|
+
end
|
data/test/xml_bindings_test.rb
CHANGED
@@ -29,16 +29,16 @@ class XMLBindingTest < MiniTest::Spec
|
|
29
29
|
describe "AttributeBinding" do
|
30
30
|
describe "with plain text items" do
|
31
31
|
before do
|
32
|
-
@property = Representable::XML::Binding::Attribute.new(Representable::Definition.new(:name, :attribute => true)
|
32
|
+
@property = Representable::XML::Binding::Attribute.new(Representable::Definition.new(:name, :attribute => true))
|
33
33
|
end
|
34
34
|
|
35
35
|
it "extracts with #read" do
|
36
|
-
assert_equal "The Gargoyle", @property.read(Nokogiri::XML("<song name=\"The Gargoyle\" />").root)
|
36
|
+
assert_equal "The Gargoyle", @property.read(Nokogiri::XML("<song name=\"The Gargoyle\" />").root, "name")
|
37
37
|
end
|
38
38
|
|
39
39
|
it "inserts with #write" do
|
40
40
|
parent = Nokogiri::XML::Node.new("song", @doc)
|
41
|
-
@property.write(parent, "The Gargoyle")
|
41
|
+
@property.write(parent, "The Gargoyle", "name")
|
42
42
|
assert_xml_equal("<song name=\"The Gargoyle\" />", parent.to_s)
|
43
43
|
end
|
44
44
|
end
|
@@ -46,16 +46,16 @@ class XMLBindingTest < MiniTest::Spec
|
|
46
46
|
|
47
47
|
describe "ContentBinding" do
|
48
48
|
before do
|
49
|
-
@property = Representable::XML::Binding::Content.new(Representable::Definition.new(:name, :content => true)
|
49
|
+
@property = Representable::XML::Binding::Content.new(Representable::Definition.new(:name, :content => true))
|
50
50
|
end
|
51
51
|
|
52
52
|
it "extracts with #read" do
|
53
|
-
assert_equal "The Gargoyle", @property.read(Nokogiri::XML("<song>The Gargoyle</song>").root)
|
53
|
+
assert_equal "The Gargoyle", @property.read(Nokogiri::XML("<song>The Gargoyle</song>").root, "song")
|
54
54
|
end
|
55
55
|
|
56
56
|
it "inserts with #write" do
|
57
57
|
parent = Nokogiri::XML::Node.new("song", @doc)
|
58
|
-
@property.write(parent, "The Gargoyle")
|
58
|
+
@property.write(parent, "The Gargoyle", "song")
|
59
59
|
assert_xml_equal("<song>The Gargoyle</song>", parent.to_s)
|
60
60
|
end
|
61
61
|
end
|
data/test/xml_test.rb
CHANGED
@@ -104,20 +104,20 @@ class XmlTest < MiniTest::Spec
|
|
104
104
|
|
105
105
|
describe "XML::Binding#build_for" do
|
106
106
|
it "returns AttributeBinding" do
|
107
|
-
assert_kind_of XML::Binding::Attribute, XML::Binding.build_for(Def.new(:band, :as => "band", :attribute => true)
|
107
|
+
assert_kind_of XML::Binding::Attribute, XML::Binding.build_for(Def.new(:band, :as => "band", :attribute => true))
|
108
108
|
end
|
109
109
|
|
110
110
|
it "returns Binding" do
|
111
|
-
assert_kind_of XML::Binding, XML::Binding.build_for(Def.new(:band, :class => Hash)
|
112
|
-
assert_kind_of XML::Binding, XML::Binding.build_for(Def.new(:band, :as => :content)
|
111
|
+
assert_kind_of XML::Binding, XML::Binding.build_for(Def.new(:band, :class => Hash))
|
112
|
+
assert_kind_of XML::Binding, XML::Binding.build_for(Def.new(:band, :as => :content))
|
113
113
|
end
|
114
114
|
|
115
115
|
it "returns CollectionBinding" do
|
116
|
-
assert_kind_of XML::Binding::Collection, XML::Binding.build_for(Def.new(:band, :collection => :true)
|
116
|
+
assert_kind_of XML::Binding::Collection, XML::Binding.build_for(Def.new(:band, :collection => :true))
|
117
117
|
end
|
118
118
|
|
119
119
|
it "returns HashBinding" do
|
120
|
-
assert_kind_of XML::Binding::Hash, XML::Binding.build_for(Def.new(:band, :hash => :true)
|
120
|
+
assert_kind_of XML::Binding::Hash, XML::Binding.build_for(Def.new(:band, :hash => :true))
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
@@ -387,7 +387,7 @@ class CollectionTest < MiniTest::Spec
|
|
387
387
|
self.representation_wrap = :song
|
388
388
|
end
|
389
389
|
|
390
|
-
let (:decorator) { rpr = representer; Class.new(Representable::Decorator) { include rpr } }
|
390
|
+
let (:decorator) { rpr = representer; Class.new(Representable::Decorator) { include Representable::XML; include rpr } }
|
391
391
|
|
392
392
|
describe "XML::Collection" do
|
393
393
|
describe "with contained objects" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: representable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: uber
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.
|
19
|
+
version: 0.0.15
|
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
|
-
version: 0.0.
|
26
|
+
version: 0.0.15
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: declarative
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.4
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +72,14 @@ dependencies:
|
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: '0'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ">="
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: mongoid
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +154,6 @@ files:
|
|
140
154
|
- TODO
|
141
155
|
- lib/representable.rb
|
142
156
|
- lib/representable/TODO.getting_serious
|
143
|
-
- lib/representable/apply.rb
|
144
157
|
- lib/representable/autoload.rb
|
145
158
|
- lib/representable/binding.rb
|
146
159
|
- lib/representable/cached.rb
|
@@ -150,6 +163,7 @@ files:
|
|
150
163
|
- lib/representable/declarative.rb
|
151
164
|
- lib/representable/decorator.rb
|
152
165
|
- lib/representable/definition.rb
|
166
|
+
- lib/representable/deprecations.rb
|
153
167
|
- lib/representable/deserializer.rb
|
154
168
|
- lib/representable/for_collection.rb
|
155
169
|
- lib/representable/hash.rb
|
@@ -157,16 +171,15 @@ files:
|
|
157
171
|
- lib/representable/hash/binding.rb
|
158
172
|
- lib/representable/hash/collection.rb
|
159
173
|
- lib/representable/hash_methods.rb
|
160
|
-
- lib/representable/
|
174
|
+
- lib/representable/insert.rb
|
161
175
|
- lib/representable/json.rb
|
162
176
|
- lib/representable/json/collection.rb
|
163
177
|
- lib/representable/json/hash.rb
|
164
|
-
- lib/representable/mapper.rb
|
165
178
|
- lib/representable/object.rb
|
166
179
|
- lib/representable/object/binding.rb
|
167
180
|
- lib/representable/parse_strategies.rb
|
168
181
|
- lib/representable/pipeline.rb
|
169
|
-
- lib/representable/
|
182
|
+
- lib/representable/pipeline_factories.rb
|
170
183
|
- lib/representable/represent.rb
|
171
184
|
- lib/representable/serializer.rb
|
172
185
|
- lib/representable/version.rb
|
@@ -177,6 +190,7 @@ files:
|
|
177
190
|
- lib/representable/yaml.rb
|
178
191
|
- lib/representable/yaml/binding.rb
|
179
192
|
- representable.gemspec
|
193
|
+
- test/---deserialize-pipeline_test.rb
|
180
194
|
- test/as_test.rb
|
181
195
|
- test/benchmarking.rb
|
182
196
|
- test/binding_test.rb
|
@@ -187,6 +201,8 @@ files:
|
|
187
201
|
- test/config_test.rb
|
188
202
|
- test/decorator_scope_test.rb
|
189
203
|
- test/decorator_test.rb
|
204
|
+
- test/default_test.rb
|
205
|
+
- test/defaults_options_test.rb
|
190
206
|
- test/definition_test.rb
|
191
207
|
- test/example.rb
|
192
208
|
- test/examples/object.rb
|
@@ -198,9 +214,9 @@ files:
|
|
198
214
|
- test/getter_setter_test.rb
|
199
215
|
- test/hash_bindings_test.rb
|
200
216
|
- test/hash_test.rb
|
217
|
+
- test/heritage_test.rb
|
201
218
|
- test/if_test.rb
|
202
219
|
- test/inherit_test.rb
|
203
|
-
- test/inheritable_test.rb
|
204
220
|
- test/inline_test.rb
|
205
221
|
- test/instance_test.rb
|
206
222
|
- test/is_representable_test.rb
|
@@ -211,10 +227,13 @@ files:
|
|
211
227
|
- test/object_test.rb
|
212
228
|
- test/parse_strategy_test.rb
|
213
229
|
- test/pass_options_test.rb
|
230
|
+
- test/pipeline_test.rb
|
231
|
+
- test/populator_test.rb
|
214
232
|
- test/prepare_test.rb
|
215
233
|
- test/private_options_test.rb
|
216
234
|
- test/reader_writer_test.rb
|
217
235
|
- test/realistic_benchmark.rb
|
236
|
+
- test/render_nil_test.rb
|
218
237
|
- test/represent_test.rb
|
219
238
|
- test/representable_test.rb
|
220
239
|
- test/schema_test.rb
|
@@ -223,6 +242,7 @@ files:
|
|
223
242
|
- test/stringify_hash_test.rb
|
224
243
|
- test/test_helper.rb
|
225
244
|
- test/test_helper_test.rb
|
245
|
+
- test/uncategorized_test.rb
|
226
246
|
- test/wrap_test.rb
|
227
247
|
- test/xml_bindings_test.rb
|
228
248
|
- test/xml_test.rb
|
@@ -242,9 +262,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
262
|
version: '0'
|
243
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
264
|
requirements:
|
245
|
-
- - "
|
265
|
+
- - ">"
|
246
266
|
- !ruby/object:Gem::Version
|
247
|
-
version:
|
267
|
+
version: 1.3.1
|
248
268
|
requirements: []
|
249
269
|
rubyforge_project:
|
250
270
|
rubygems_version: 2.4.8
|