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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 478d75b5589a44d477e5fd3cf3d007770219f490
4
- data.tar.gz: 5c7112be19940a322ec497e6a3977e4ac91a96ba
3
+ metadata.gz: 2a785aab5485f2ce77dab6936674769fac4826e6
4
+ data.tar.gz: 7078a020e6053b70e45e52a660ade06265fbdefd
5
5
  SHA512:
6
- metadata.gz: 2cfd9f8a9940c57298b129c1dacd18dd0a14ff68cce2d5d68d6300ba6563671243108c54db865ea862849d246ffd6ff2d313ce64603bd9b57310b0bbe6346a2d
7
- data.tar.gz: d3d362a3aca7bbed2508ed16a23cfb5a97c4b8a76f590c31b459e5cadd61ed33df4b19a2c0c5dda4de5247179dddde35d781686b805af9ea18c2a70477326889
6
+ metadata.gz: 24cd41a535c28fd31a1627bd9c12e47640724558131b0b931c41b226ee2b824100ffd7455de7cd6a1c3d17f3081aa0b55d4fb100ec72a0d6c111d8a50534c529
7
+ data.tar.gz: 567357bb89d0b137f1f3d123e1fa57694ef3c53e2055df247300621bcf7c4a510a46d593fb83d59ef092820a8379af747128d06d6a0b7ef64b56d48397ae6316
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- upholsterer (0.4.0)
4
+ upholsterer (0.4.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -31,6 +31,7 @@ module Upholsterer
31
31
  @subjects = names
32
32
  attr_reader *names
33
33
  private *names
34
+ public :subject
34
35
  end
35
36
 
36
37
  @subjects
@@ -1,7 +1,7 @@
1
1
  module Upholsterer
2
2
  class Base
3
3
  def to_hash
4
- Hash[public_methods(false).collect do |field|
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
@@ -2,7 +2,7 @@ module Upholsterer
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 0
5
+ PATCH = 1
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
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.private_methods).to include(:subject)
77
+ expect(subject.public_methods).to include(:subject)
78
78
  end
79
79
 
80
80
  it 'returns subject' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upholsterer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira