Skip to content
instance method

Gem::Platform#deconstruct

deconstruct

Alias of #to_a

Deconstructs the platform into an array for pattern matching. Returns [cpu, os, version].

Example
Gem::Platform.new("x86_64-linux").deconstruct  #=> ["x86_64", "linux", nil]

This enables array pattern matching:

Example
case Gem::Platform.new("arm64-darwin-21")
in ["arm64", "darwin", version]
  # version => "21"
end
See also #to_a #=~ #deconstruct_keys #=== also in 4.1