instance method
Gem::Platform#deconstruct
deconstruct
lib/rubygems/platform.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/platform.rb, line 130
def to_a
[@cpu, @os, @version]
end
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