Skip to content

Commit

Permalink
Add workaround for Crystal < 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Dec 13, 2023
1 parent d358ed4 commit a3d3632
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tuple.cr
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,11 @@ struct Tuple
# {1, 2, 3, 4, 5}.to_a # => [1, 2, 3, 4, 5]
# ```
def to_a : Array(Union(*T))
to_a(&.itself)
{% if compare_versions(Crystal::VERSION, "1.1.0") < 0 %}
to_a(&.itself.as(Union(*T)))
{% else %}
to_a(&.itself)
{% end %}
end

# Returns an `Array` with the results of running *block* against each element of the tuple.
Expand Down

0 comments on commit a3d3632

Please sign in to comment.