Skip to content

Commit

Permalink
fix ruby 3.3 compatibility
Browse files Browse the repository at this point in the history
- closes #6
  • Loading branch information
ezekg committed Jan 1, 2024
1 parent b2ac5d7 commit e5343f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/typed_params/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ def self.call(*args, **kwargs, &block)
# │ 1 ││ 2 │ │ 5 │
# └───┘└───┘ └───┘
#
def depth_first_map(param, &)
def depth_first_map(param, &block)
return if param.nil?

# Postorder DFS, so we'll visit the children first.
if param.schema.children&.any?
case param.schema.children
in Array if param.array?
if param.schema.indexed?
param.schema.children.each_with_index { |v, i| self.class.call(param[i], schema: v, controller:, &) }
param.schema.children.each_with_index { |v, i| self.class.call(param[i], schema: v, controller:, &block) }
else
param.value.each { |v| self.class.call(v, schema: param.schema.children.first, controller:, &) }
param.value.each { |v| self.class.call(v, schema: param.schema.children.first, controller:, &block) }
end
in Hash if param.hash?
param.schema.children.each { |k, v| self.class.call(param[k], schema: v, controller:, &) }
param.schema.children.each { |k, v| self.class.call(param[k], schema: v, controller:, &block) }
else
end
end
Expand Down

0 comments on commit e5343f8

Please sign in to comment.