Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/pp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,20 @@ def comma_breakable
def seplist(list, sep=nil, iter_method=:each) # :yield: element
sep ||= lambda { comma_breakable }
first = true
kwsplat = EMPTY_KWHASH
list.__send__(iter_method) {|*v|
if first
first = false
else
sep.call
end
RUBY_VERSION >= "3.0" ? yield(*v, **{}) : yield(*v)
kwsplat ? yield(*v, **kwsplat) : yield(*v)
}
end
EMPTY_KWHASH = if RUBY_VERSION >= "3.0"
{}.freeze
end
private_constant :EMPTY_KWHASH

# A present standard failsafe for pretty printing any given Object
def pp_object(obj)
Expand Down
Loading