representable 2.0.3 → 2.0.4
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.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -1
- data/lib/representable/decorator.rb +1 -0
- data/lib/representable/json.rb +1 -0
- data/lib/representable/parse_strategies.rb +2 -2
- data/lib/representable/version.rb +1 -1
- data/lib/representable/xml.rb +1 -0
- data/test/lonely_test.rb +0 -1
- data/test/parse_strategy_test.rb +5 -5
- data/test/xml_test.rb +0 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ae87cf0d1e79ff26480467bc624e3df5633e2b5
|
4
|
+
data.tar.gz: f46dd9c54daa7efb76af07add37e17780fb81b59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77511aff2f7d3d88a31c29b4feeec1d4b2c4dd31ec612a3c7521994007adcef4541b89ed14bf54338e796f539023b2cb6cbefc40efe71c7699c30d720c81bcce
|
7
|
+
data.tar.gz: 1983166eda318f1a45cbb349707aae61e2482952e9c29143a5791c6384ed9d4e7cfd1b0efc3a2d6ef083d9626e16e56aef9c6e857ad118775dbbe2d1d4e1859c
|
data/CHANGES.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
# 2.0.4
|
2
|
+
|
3
|
+
* Fix implicit rendering of JSON and XML collections where json/collection wasn't loaded properly, resulting in the native JSON's `#to_json` to be called.
|
4
|
+
* Fix `:find_or_instantiate` parse strategy which wouldn't instantiate but raise an error. Thanks to @d4rky-pl.
|
5
|
+
|
1
6
|
# 2.0.3
|
2
7
|
|
3
|
-
|
8
|
+
* Fixed a bug where `Forwardable` wasn't available (because we didn't require it :).
|
4
9
|
|
5
10
|
# 2.0.2
|
6
11
|
|
@@ -14,6 +14,7 @@ module Representable
|
|
14
14
|
|
15
15
|
include Representable # include after class methods so Decorator::prepare can't be overwritten by Representable::prepare.
|
16
16
|
|
17
|
+
# TODO: implement that just by calling ::property(name, options){include mod} on the inheriting representer.
|
17
18
|
module InheritModule
|
18
19
|
def inherit_module!(parent)
|
19
20
|
inherited_attrs = parent.representable_attrs[:definitions].keys
|
data/lib/representable/json.rb
CHANGED
@@ -50,9 +50,9 @@ module Representable
|
|
50
50
|
args = args.last # TODO: don't pass i as separate block parameter but in Options.
|
51
51
|
object_class = args.binding[:class].evaluate(self, fragment, args)
|
52
52
|
|
53
|
-
object_class.
|
53
|
+
object_class.find_by(id: fragment["id"]) or object_class.new
|
54
54
|
}
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
58
|
-
end
|
58
|
+
end
|
data/lib/representable/xml.rb
CHANGED
data/test/lonely_test.rb
CHANGED
data/test/parse_strategy_test.rb
CHANGED
@@ -145,8 +145,8 @@ class ParseStrategyFindOrInstantiateTest < BaseTest
|
|
145
145
|
|
146
146
|
Song = Struct.new(:id, :title)
|
147
147
|
Song.class_eval do
|
148
|
-
def self.
|
149
|
-
return new(1, "Resist Stan") if id==1# we should return the same object here
|
148
|
+
def self.find_by(attributes={})
|
149
|
+
return new(1, "Resist Stan") if attributes[:id]==1# we should return the same object here
|
150
150
|
new
|
151
151
|
end
|
152
152
|
end
|
@@ -227,8 +227,8 @@ end
|
|
227
227
|
class ParseStrategyLambdaTest < MiniTest::Spec
|
228
228
|
Song = Struct.new(:id, :title)
|
229
229
|
Song.class_eval do
|
230
|
-
def self.
|
231
|
-
return new(1, "Resist Stan") if id==1# we should return the same object here
|
230
|
+
def self.find_by(attributes={})
|
231
|
+
return new(1, "Resist Stan") if attributes[:id]==1# we should return the same object here
|
232
232
|
new
|
233
233
|
end
|
234
234
|
end
|
@@ -276,4 +276,4 @@ class ParseStrategyLambdaTest < MiniTest::Spec
|
|
276
276
|
|
277
277
|
# TODO: test with existing collection
|
278
278
|
end
|
279
|
-
end
|
279
|
+
end
|
data/test/xml_test.rb
CHANGED
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.0.
|
4
|
+
version: 2.0.4
|
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-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -260,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
260
|
version: '0'
|
261
261
|
requirements: []
|
262
262
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.2.
|
263
|
+
rubygems_version: 2.2.1
|
264
264
|
signing_key:
|
265
265
|
specification_version: 4
|
266
266
|
summary: Renders and parses JSON/XML/YAML documents from and to Ruby objects. Includes
|
@@ -308,3 +308,4 @@ test_files:
|
|
308
308
|
- test/xml_bindings_test.rb
|
309
309
|
- test/xml_test.rb
|
310
310
|
- test/yaml_test.rb
|
311
|
+
has_rdoc:
|