mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix Arguments to_s
This commit is contained in:
parent
e38e3ecc32
commit
163f94287e
2 changed files with 4 additions and 5 deletions
|
@ -44,7 +44,7 @@ Spectator.describe Spectator::Arguments do
|
||||||
subject { arguments.to_s }
|
subject { arguments.to_s }
|
||||||
|
|
||||||
it "formats the arguments" do
|
it "formats the arguments" do
|
||||||
is_expected.to eq("(42, \"foo\", bar: \"baz\", qux: 123)")
|
is_expected.to eq("(42, \"foo\", *splat: {:x, :y, :z}, bar: \"baz\", qux: 123)")
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when empty" do
|
context "when empty" do
|
||||||
|
|
|
@ -92,16 +92,15 @@ module Spectator
|
||||||
|
|
||||||
# Add the splat arguments.
|
# Add the splat arguments.
|
||||||
if (extra = @extra) && !extra.empty?
|
if (extra = @extra) && !extra.empty?
|
||||||
if splat = @splat_name
|
|
||||||
io << splat << ": {"
|
|
||||||
end
|
|
||||||
io << ", " unless positional.empty?
|
io << ", " unless positional.empty?
|
||||||
|
if splat = @splat_name
|
||||||
|
io << '*' << splat << ": {"
|
||||||
|
end
|
||||||
extra.each_with_index do |arg, i|
|
extra.each_with_index do |arg, i|
|
||||||
io << ", " if i > 0
|
io << ", " if i > 0
|
||||||
arg.inspect(io)
|
arg.inspect(io)
|
||||||
end
|
end
|
||||||
io << '}' if @splat_name
|
io << '}' if @splat_name
|
||||||
io << ", " unless kwargs.empty?
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add the keyword arguments.
|
# Add the keyword arguments.
|
||||||
|
|
Loading…
Reference in a new issue