Skip to content

Commit

Permalink
Introspection change (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-taylor authored Mar 13, 2022
1 parent f527601 commit 957cb1f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
json_schematize (0.4.0)
json_schematize (0.5.0)

GEM
remote: https://rubygems.org/
Expand Down
3 changes: 2 additions & 1 deletion lib/json_schematize/introspect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def deep_inspect(with_raw_params: false, with_field: false)
end

def inspect
"#<#{self.class} - required fields: #{self.class.required_fields.map(&:name)}; optional fields: #{self.class.optional_fields.map(&:name)}>"
stringify = to_h.map { |k, v| "#{k}:#{v}" }.join(", ")
"#<#{self.class} - required fields: #{self.class.required_fields.map(&:name)}; #{stringify}>"
end
end
2 changes: 1 addition & 1 deletion lib/json_schematize/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module JsonSchematize
VERSION = "0.5.0"
VERSION = "0.5.1"
end
2 changes: 1 addition & 1 deletion spec/lib/json_schematize/generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class IntrospectKlassInspect < described_class
end
IntrospectKlassInspect
end
let(:expected) { "#<#{klass} - required fields: #{params.keys}; optional fields: []>" }
let(:expected) { "#<#{klass} - required fields: #{params.keys}; #{instance.to_h.map { |k, v| "#{k}:#{v}" }.join(", ")}>" }
it { is_expected.to eq(expected) }
end
end
Expand Down

0 comments on commit 957cb1f

Please sign in to comment.