Skip to content

Commit 1107734

Browse files
authored
Empty check should be first (#20)
* reset ordering * version
1 parent 373c352 commit 1107734

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
json_schematize (0.13.0)
4+
json_schematize (0.13.1)
55
class_composer (>= 1.0)
66

77
GEM

lib/json_schematize/introspect_instance_methods.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ module InstanceMethods
55
def to_h
66
self.class.fields.map do |field|
77
value = method(:"#{field.name}").()
8-
if field.array_of_types
8+
if value.class == JsonSchematize::EmptyValue
9+
[field.name, nil]
10+
elsif field.array_of_types
911
[field.name, value.map(&:to_h)]
1012
elsif value.class == Class
1113
[field.name, value.to_s]
12-
elsif value.class == JsonSchematize::EmptyValue
13-
[field.name, nil]
1414
elsif JsonSchematize::Generator > value.class
1515
[field.name, value.to_h]
1616
else

lib/json_schematize/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module JsonSchematize
4-
VERSION = "0.13.0"
4+
VERSION = "0.13.1"
55
end

0 commit comments

Comments
 (0)