Skip to content

Commit

Permalink
A Hash argument is treated as kwargs in Ruby 2
Browse files Browse the repository at this point in the history
  • Loading branch information
amatsuda committed Aug 18, 2024
1 parent 86d090c commit 2cca814
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ module EnumSyntaxConverter
def enum(name = nil, values = nil, **options, &block)
return super options, &block if name == nil

new_options = {}
if (prefix = options.delete :prefix)
options[:_prefix] = prefix
new_options[:_prefix] = prefix
end
if (suffix = options.delete :suffix)
options[:_suffix] = suffix
new_options[:_suffix] = suffix
end
super options.merge(name => values), &block
super new_options.merge(name => (values || options)), &block
end
end

Expand Down

0 comments on commit 2cca814

Please sign in to comment.