Skip to content

Commit

Permalink
Change usage to hash conversion to support older rubies
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrmurach committed May 5, 2020
1 parent 5f8a5c8 commit d08f787
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/tty/option/usage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,10 @@ def footer?
# @api public
def to_h(&block)
if block_given?
@properties.to_h(&block)
@properties.each_with_object({}) do |(key, val), acc|
k, v = *block.(key, val)
acc[k] = v
end
else
DeepDup.deep_dup(@properties)
end
Expand Down

0 comments on commit d08f787

Please sign in to comment.