ializer 0.9.0 → 0.9.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
  SHA256:
3
- metadata.gz: 94f2932d08df7f0236c889c447159ff88c2aebb3761f754cee5acaa31a49586d
4
- data.tar.gz: a2b8e77a53cb3f38a619b616c48cdab480af0b7890952bb82632ea8fece8d1b3
3
+ metadata.gz: 436adbeed83a5f03cb2f5efe5f1ed07f3e7647e7fa15732e7af92923bc6165f5
4
+ data.tar.gz: c4d2dbc6a03164d51eb577a6a1fe084f35dca996739b75c6d78d7760dfb434cc
5
5
  SHA512:
6
- metadata.gz: 6fe88893e5ee61a1cef8b28f52add84a2d54da0a37e2556167dc8f1ee9ac9afd836104837a5c75cc4dc9a71208e0fe1d4f41664554ad8a93b816afd14f213c3b
7
- data.tar.gz: 854229b905bedce44414a452e9fbf91b0cd44d88ce26ee6aebdc2fe809ed69056dcda0caa2b55766a02695a12e73855d742b5247f23e0abca1dc88b33dad321a
6
+ metadata.gz: b563551fb9ebdb39f866c6c1fe58977b9e5c074d1ba4bf0e5a3d040efe191056f4728549e0e36cc34b6f33801aecd83638885c86f04affb07c2c28726ca2f38e
7
+ data.tar.gz: 82aa9bb2072c937b1f23464418744eb7fff88cb90ea8d97b2ce5f9e99249aa71e59f6050b5da6d014bb9edc5d62c6561b127ac14204502ead6b5cfecd3a1dd89
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ializer
4
- VERSION = '0.9.0'
4
+ VERSION = '0.9.1'
5
5
  end
data/lib/ser/ializer.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/hash_with_indifferent_access'
4
+ require 'active_support/core_ext/hash'
5
+
3
6
  module Ser
4
7
  class Ializer # rubocop:disable Metrics/ClassLength
5
8
  @@method_registry = {} # rubocop:disable Style/ClassVars
@@ -111,7 +114,7 @@ module Ser
111
114
  def _attributes
112
115
  @attributes ||=
113
116
  if equal? Ser::Ializer
114
- {}
117
+ ActiveSupport::HashWithIndifferentAccess.new
115
118
  else
116
119
  superclass._attributes.dup
117
120
  end
@@ -168,14 +171,15 @@ module Ser
168
171
 
169
172
  return _attributes.values unless field_names
170
173
 
171
- _attributes.values_at(*field_names)
174
+ _attributes.values_at(*field_names).compact
172
175
  end
173
176
 
174
- def fields_names_for_serialization(context) # rubocop:disable Metrics/CyclomaticComplexity
177
+ def fields_names_for_serialization(context)
175
178
  return nil unless context
176
179
 
177
180
  if context.is_a?(Hash)
178
- return context[:attributes] || context[:include] || context['attributes'] || context['include']
181
+ context = context.with_indifferent_access
182
+ return context[:attributes] || context[:include]
179
183
  end
180
184
 
181
185
  return context.attributes if context.respond_to?(:attributes)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Steinberg