grape-entity 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/grape_entity/entity.rb +3 -2
- data/lib/grape_entity/version.rb +1 -1
- data/spec/grape_entity/entity_spec.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a2e44f74dcea5b8a3246cff9b4e37e9bb41ebe3
|
4
|
+
data.tar.gz: 73cd0f7449e63b8a23db6930216b45cc1346e620
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 434022e3992890cd9328770146b07156ba5ce0ff64321f659b7216cae73f06e426a5b800caf4f47338e7ef665d1e66352cda437203a57601b1bc47ffb50a28bf
|
7
|
+
data.tar.gz: 87e69046e3564712b3648ba10f05f8166e77230503cb0561808302987823494cbb2f540219fa0ae9422994b38a38bbc144b15236e6a2f6bf1c129f134f69f67c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
0.4.7 (2015-08-03)
|
2
|
+
==================
|
3
|
+
* [#164](https://github.com/intridea/grape-entity/pull/164): Regression: entity instance methods were exposed with `NoMethodError`: [#163](https://github.com/intridea/grape-entity/issues/163) - [@marshall-lee](http://github.com/marshall-lee).
|
4
|
+
|
1
5
|
0.4.6 (2015-07-27)
|
2
6
|
==================
|
3
7
|
|
data/lib/grape_entity/entity.rb
CHANGED
@@ -589,10 +589,11 @@ module Grape
|
|
589
589
|
true
|
590
590
|
else
|
591
591
|
name = self.class.name_for(attribute)
|
592
|
+
is_delegatable = delegator.delegatable?(name) || respond_to?(name, true)
|
592
593
|
if exposure_options[:safe]
|
593
|
-
|
594
|
+
is_delegatable
|
594
595
|
else
|
595
|
-
|
596
|
+
is_delegatable || fail(NoMethodError, "#{self.class.name} missing attribute `#{name}' on #{object}")
|
596
597
|
end
|
597
598
|
end
|
598
599
|
end
|
data/lib/grape_entity/version.rb
CHANGED
@@ -1198,6 +1198,10 @@ describe Grape::Entity do
|
|
1198
1198
|
rep = EntitySpec::DelegatingEntity.new(friend)
|
1199
1199
|
expect(rep.send(:value_for, :name)).to eq 'cooler name'
|
1200
1200
|
expect(rep.send(:value_for, :email)).to eq 'joe@example.com'
|
1201
|
+
|
1202
|
+
another_friend = double('Friend', email: 'joe@example.com')
|
1203
|
+
rep = EntitySpec::DelegatingEntity.new(another_friend)
|
1204
|
+
expect(rep.send(:value_for, :name)).to eq 'cooler name'
|
1201
1205
|
end
|
1202
1206
|
|
1203
1207
|
context 'using' do
|