upholsterer 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/upholsterer/base.rb +1 -0
- data/lib/upholsterer/json_presenter.rb +8 -1
- data/lib/upholsterer/version.rb +1 -1
- data/spec/base_spec.rb +1 -1
- 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: 2a785aab5485f2ce77dab6936674769fac4826e6
|
4
|
+
data.tar.gz: 7078a020e6053b70e45e52a660ade06265fbdefd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24cd41a535c28fd31a1627bd9c12e47640724558131b0b931c41b226ee2b824100ffd7455de7cd6a1c3d17f3081aa0b55d4fb100ec72a0d6c111d8a50534c529
|
7
|
+
data.tar.gz: 567357bb89d0b137f1f3d123e1fa57694ef3c53e2055df247300621bcf7c4a510a46d593fb83d59ef092820a8379af747128d06d6a0b7ef64b56d48397ae6316
|
data/Gemfile.lock
CHANGED
data/lib/upholsterer/base.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Upholsterer
|
2
2
|
class Base
|
3
3
|
def to_hash
|
4
|
-
Hash[
|
4
|
+
Hash[json_fields.collect do |field|
|
5
5
|
[field, public_send(field)]
|
6
6
|
end]
|
7
7
|
end
|
@@ -12,5 +12,12 @@ module Upholsterer
|
|
12
12
|
|
13
13
|
alias :to_h :to_hash
|
14
14
|
alias :as_json :to_json
|
15
|
+
|
16
|
+
private
|
17
|
+
def json_fields
|
18
|
+
@json_fields ||= public_methods(false).tap do |fields|
|
19
|
+
fields.delete(:subject)
|
20
|
+
end
|
21
|
+
end
|
15
22
|
end
|
16
23
|
end
|
data/lib/upholsterer/version.rb
CHANGED
data/spec/base_spec.rb
CHANGED
@@ -74,7 +74,7 @@ describe Upholsterer::Base do
|
|
74
74
|
its(:email) { should == 'john@doe.com' }
|
75
75
|
|
76
76
|
it 'responds to private subject method' do
|
77
|
-
expect(subject.
|
77
|
+
expect(subject.public_methods).to include(:subject)
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'returns subject' do
|