diff --git a/src/spectator/abstract_expression.cr b/src/spectator/abstract_expression.cr index b58c1cc..6ab4cbf 100644 --- a/src/spectator/abstract_expression.cr +++ b/src/spectator/abstract_expression.cr @@ -34,7 +34,7 @@ module Spectator # Produces a string representation of the expression. # This consists of the label (if one is available) and the value. - def to_s(io) + def to_s(io : IO) : Nil if (label = @label) io << label << ": " end @@ -43,7 +43,7 @@ module Spectator # Produces a detailed string representation of the expression. # This consists of the label (if one is available) and the value. - def inspect(io) + def inspect(io : IO) : Nil if (label = @label) io << label << ": " end diff --git a/src/spectator/anything.cr b/src/spectator/anything.cr index e4d7b34..aa25e3c 100644 --- a/src/spectator/anything.cr +++ b/src/spectator/anything.cr @@ -13,12 +13,12 @@ module Spectator end # Displays "anything". - def to_s(io) + def to_s(io : IO) : Nil io << "anything" end # Displays "". - def inspect(io) + def inspect(io : IO) : Nil io << "" end end diff --git a/src/spectator/context.cr b/src/spectator/context.cr index c3213e3..7fc126b 100644 --- a/src/spectator/context.cr +++ b/src/spectator/context.cr @@ -10,12 +10,12 @@ abstract class SpectatorContext # and that the Crystal compiler instantiates a `#to_s` and/or `#inspect` for each of those types, # an explosion in method instances can be created. # The compile time is drastically reduced by using a dummy string instead. - def to_s(io) + def to_s(io : IO) : Nil io << "Context" end # :ditto: - def inspect(io) + def inspect(io : IO) : Nil io << "Context<" << self.class << '>' end end diff --git a/src/spectator/error_result.cr b/src/spectator/error_result.cr index 4babc2a..a4531fb 100644 --- a/src/spectator/error_result.cr +++ b/src/spectator/error_result.cr @@ -16,7 +16,7 @@ module Spectator end # One-word description of the result. - def to_s(io) + def to_s(io : IO) : Nil io << "error" end diff --git a/src/spectator/example.cr b/src/spectator/example.cr index 8f99e93..06e0f19 100644 --- a/src/spectator/example.cr +++ b/src/spectator/example.cr @@ -191,7 +191,7 @@ module Spectator # Constructs the full name or description of the example. # This prepends names of groups this example is part of. - def to_s(io) + def to_s(io : IO) : Nil name = @name # Prefix with group's full name if the node belongs to a group. @@ -210,7 +210,7 @@ module Spectator end # Exposes information about the example useful for debugging. - def inspect(io) + def inspect(io : IO) : Nil super io << ' ' << result end @@ -286,7 +286,7 @@ module Spectator # Constructs the full name or description of the example. # This prepends names of groups this example is part of. - def to_s(io) : Nil + def to_s(io : IO) : Nil @example.to_s(io) end end diff --git a/src/spectator/example_group.cr b/src/spectator/example_group.cr index 0481fc4..bb702e4 100644 --- a/src/spectator/example_group.cr +++ b/src/spectator/example_group.cr @@ -112,7 +112,7 @@ module Spectator # Constructs the full name or description of the example group. # This prepends names of groups this group is part of. - def to_s(io) + def to_s(io : IO) : Nil # Prefix with group's full name if the node belongs to a group. return unless parent = @group diff --git a/src/spectator/example_group_hook.cr b/src/spectator/example_group_hook.cr index bd6bac8..aee357f 100644 --- a/src/spectator/example_group_hook.cr +++ b/src/spectator/example_group_hook.cr @@ -42,7 +42,7 @@ module Spectator # Produces the string representation of the hook. # Includes the location and label if they're not nil. - def to_s(io) + def to_s(io : IO) : Nil io << "example group hook" if (label = @label) diff --git a/src/spectator/example_hook.cr b/src/spectator/example_hook.cr index edebf26..6bc77a0 100644 --- a/src/spectator/example_hook.cr +++ b/src/spectator/example_hook.cr @@ -37,7 +37,7 @@ module Spectator # Produces the string representation of the hook. # Includes the location and label if they're not nil. - def to_s(io) + def to_s(io : IO) : Nil io << "example hook" if (label = @label) diff --git a/src/spectator/example_procsy_hook.cr b/src/spectator/example_procsy_hook.cr index 8a64f17..16bc970 100644 --- a/src/spectator/example_procsy_hook.cr +++ b/src/spectator/example_procsy_hook.cr @@ -39,7 +39,7 @@ module Spectator # Produces the string representation of the hook. # Includes the location and label if they're not nil. - def to_s(io) + def to_s(io : IO) : Nil io << "example hook" if (label = @label) diff --git a/src/spectator/fail_result.cr b/src/spectator/fail_result.cr index 36ea8fb..c283a80 100644 --- a/src/spectator/fail_result.cr +++ b/src/spectator/fail_result.cr @@ -55,7 +55,7 @@ module Spectator end # One-word description of the result. - def to_s(io) + def to_s(io : IO) : Nil io << "fail" end diff --git a/src/spectator/formatting/components/comment.cr b/src/spectator/formatting/components/comment.cr index b398840..30f4293 100644 --- a/src/spectator/formatting/components/comment.cr +++ b/src/spectator/formatting/components/comment.cr @@ -16,7 +16,7 @@ module Spectator::Formatting::Components end # Writes the comment to the output. - def to_s(io) + def to_s(io : IO) : Nil io << "# " << @content end end diff --git a/src/spectator/formatting/components/example_command.cr b/src/spectator/formatting/components/example_command.cr index 8b3c0b9..b1246db 100644 --- a/src/spectator/formatting/components/example_command.cr +++ b/src/spectator/formatting/components/example_command.cr @@ -9,7 +9,7 @@ module Spectator::Formatting::Components end # Produces output for running the previously specified example. - def to_s(io) + def to_s(io : IO) : Nil io << "crystal spec " # Use location for argument if it's available, since it's simpler. diff --git a/src/spectator/formatting/components/failure_command_list.cr b/src/spectator/formatting/components/failure_command_list.cr index 7da5ed2..7eab4f5 100644 --- a/src/spectator/formatting/components/failure_command_list.cr +++ b/src/spectator/formatting/components/failure_command_list.cr @@ -10,7 +10,7 @@ module Spectator::Formatting::Components end # Produces the list of commands to run failed examples. - def to_s(io) + def to_s(io : IO) : Nil io.puts "Failed examples:" io.puts @failures.each do |failure| diff --git a/src/spectator/formatting/components/profile.cr b/src/spectator/formatting/components/profile.cr index 2a56e0d..b98d8f5 100644 --- a/src/spectator/formatting/components/profile.cr +++ b/src/spectator/formatting/components/profile.cr @@ -9,7 +9,7 @@ module Spectator::Formatting::Components end # Produces the output containing the profiling information. - def to_s(io) + def to_s(io : IO) : Nil io << "Top " io << @profile.size io << " slowest examples (" diff --git a/src/spectator/formatting/components/result_block.cr b/src/spectator/formatting/components/result_block.cr index bf4b3d2..ddd9c47 100644 --- a/src/spectator/formatting/components/result_block.cr +++ b/src/spectator/formatting/components/result_block.cr @@ -41,7 +41,7 @@ module Spectator::Formatting::Components private abstract def content(io) # Writes the component's output to the specified stream. - def to_s(io) + def to_s(io : IO) : Nil title_line(io) # Ident over to align with the spacing used by the index. indent(index_digit_count + 2) do diff --git a/src/spectator/formatting/components/runtime.cr b/src/spectator/formatting/components/runtime.cr index 9f28813..9638d93 100644 --- a/src/spectator/formatting/components/runtime.cr +++ b/src/spectator/formatting/components/runtime.cr @@ -15,7 +15,7 @@ module Spectator::Formatting::Components # #:##:## # # days #:##:## # ``` - def to_s(io) + def to_s(io : IO) : Nil millis = @span.total_milliseconds return format_micro(io, millis * 1000) if millis < 1 diff --git a/src/spectator/formatting/components/stats.cr b/src/spectator/formatting/components/stats.cr index ab76c7c..47e1063 100644 --- a/src/spectator/formatting/components/stats.cr +++ b/src/spectator/formatting/components/stats.cr @@ -11,7 +11,7 @@ module Spectator::Formatting::Components end # Displays the stats. - def to_s(io) + def to_s(io : IO) : Nil runtime(io) totals(io) if seed = @report.random_seed? diff --git a/src/spectator/formatting/components/tap_profile.cr b/src/spectator/formatting/components/tap_profile.cr index 64c36b0..4154e07 100644 --- a/src/spectator/formatting/components/tap_profile.cr +++ b/src/spectator/formatting/components/tap_profile.cr @@ -10,7 +10,7 @@ module Spectator::Formatting::Components end # Produces the output containing the profiling information. - def to_s(io) + def to_s(io : IO) : Nil io << "# Top " io << @profile.size io << " slowest examples (" diff --git a/src/spectator/formatting/components/totals.cr b/src/spectator/formatting/components/totals.cr index 941b6ee..4063cae 100644 --- a/src/spectator/formatting/components/totals.cr +++ b/src/spectator/formatting/components/totals.cr @@ -31,7 +31,7 @@ module Spectator::Formatting::Components end # Writes the counts to the output. - def to_s(io) + def to_s(io : IO) : Nil io << @examples << " examples, " << @failures << " failures" if @errors > 0 diff --git a/src/spectator/location.cr b/src/spectator/location.cr index 688fdb6..7b06eb9 100644 --- a/src/spectator/location.cr +++ b/src/spectator/location.cr @@ -59,7 +59,7 @@ module Spectator # ```text # FILE:LINE # ``` - def to_s(io) + def to_s(io : IO) : Nil io << path << ':' << line end end diff --git a/src/spectator/matchers/attributes_matcher.cr b/src/spectator/matchers/attributes_matcher.cr index 8ecd714..c66ecc4 100644 --- a/src/spectator/matchers/attributes_matcher.cr +++ b/src/spectator/matchers/attributes_matcher.cr @@ -15,7 +15,7 @@ module Spectator::Matchers extend self # Text displayed when a method is undefined. - def inspect(io) + def inspect(io : IO) : Nil io << "" end end diff --git a/src/spectator/node.cr b/src/spectator/node.cr index c5a64b6..807c8df 100644 --- a/src/spectator/node.cr +++ b/src/spectator/node.cr @@ -66,12 +66,12 @@ module Spectator # Constructs the full name or description of the node. # This prepends names of groups this node is part of. - def to_s(io) + def to_s(io : IO) : Nil display_name.to_s(io) end # Exposes information about the node useful for debugging. - def inspect(io) + def inspect(io : IO) : Nil # Full node name. io << '"' << self << '"' diff --git a/src/spectator/pass_result.cr b/src/spectator/pass_result.cr index 2b62383..20e3b04 100644 --- a/src/spectator/pass_result.cr +++ b/src/spectator/pass_result.cr @@ -24,7 +24,7 @@ module Spectator end # One-word description of the result. - def to_s(io) + def to_s(io : IO) : Nil io << "pass" end diff --git a/src/spectator/pending_result.cr b/src/spectator/pending_result.cr index 03700d9..cff38c5 100644 --- a/src/spectator/pending_result.cr +++ b/src/spectator/pending_result.cr @@ -43,7 +43,7 @@ module Spectator end # One-word description of the result. - def to_s(io) + def to_s(io : IO) : Nil io << "pending" end