nagare 1.2.0 → 1.3.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nagare.rb +16 -2
  3. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d29bebe46c6d9ea795969abac4c5e00c5974c6b9
4
- data.tar.gz: 42eeee85ab181e02133ef01203046a6adce7f655
3
+ metadata.gz: 0539766dcdb5d45a8bec091184fbaca8c96af476
4
+ data.tar.gz: 0550a8513b31249a51d8014faf93a152750198a8
5
5
  SHA512:
6
- metadata.gz: e247d30b116d4ba8051a6240828d89f1d83b7ee995f0623bd9caac83db2e6e802cb0eb9247ffccd4a6a22f1a5cc56fe0df36d6c697abd3f3c90b86d007e4195c
7
- data.tar.gz: d423ccae71135159415abfc4d240339eabd1b151659dd4ff6af91cccbabd83b962e5e1941685923657c71c716da95cf8e2a2e61e69fec40ad5f558e3c7892e7d
6
+ metadata.gz: 320f025f77101f9663063008d87f4ba98e69293d6f8b531be253c422eea363628f34b9ddee9f5ae299987df6057425c35180af18fa0439769476c817744666bc
7
+ data.tar.gz: d1e05d1290f20fb0967dd64736e4f3d9480c5198c97e9435c31dcb8c06b7ff5a393d14ec6b29d8924eb1f4a66322b32792eb2d15ac168569041d144bd81d5f34
@@ -27,16 +27,30 @@ module Nagare
27
27
  super
28
28
  end
29
29
 
30
+ def self._options
31
+ @options ||= {}
32
+ end
33
+
34
+ def self.options(options)
35
+ @options = options
36
+ end
37
+
30
38
  def initialize(object, context)
31
39
  @object = object
32
40
  @context = context
33
41
  end
34
42
 
35
43
  def attributes
36
- self.class._attributes.inject({}) do |hash, attribute|
44
+ attributes = self.class._attributes.inject({}) do |hash, attribute|
37
45
  hash[attribute.to_s] = send(attribute)
38
46
  hash
39
- end.compact
47
+ end
48
+
49
+ if !self.class._options.fetch(:nil, false)
50
+ attributes.compact
51
+ else
52
+ attributes
53
+ end
40
54
  end
41
55
 
42
56
  def method_missing(key, *args)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagare
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Oestrich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-17 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -72,3 +72,4 @@ signing_key:
72
72
  specification_version: 4
73
73
  summary: Serialize your ruby objects
74
74
  test_files: []
75
+ has_rdoc: