Skip to content

Commit e79945b

Browse files
committed
🎨 ♻️ Use :alias_method, and DRY up code
1 parent cb0bd0d commit e79945b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/graphql/schema/input_object.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ def initialize(arguments = nil, ruby_kwargs: nil, context:, defaults_used:)
6363
end
6464

6565
def to_h
66-
@ruby_style_hash.reduce({}) do |h, (key, value)|
67-
h.merge!(key => unwrap_value(value))
68-
end
66+
unwrap_value(@ruby_style_hash)
6967
end
70-
alias to_hash to_h
68+
69+
alias_method :to_hash, :to_h
7170

7271
def prepare
7372
if context

0 commit comments

Comments
 (0)