Class: CreateRubyGem::Compatibility::Matrix::Entry
- Inherits:
-
Struct
- Object
- Struct
- CreateRubyGem::Compatibility::Matrix::Entry
- Defined in:
- lib/create_ruby_gem/compatibility/matrix.rb
Overview
A single row in the compatibility table.
Instance Attribute Summary collapse
-
#requirement ⇒ Gem::Requirement
readonly
Bundler version range this entry covers.
-
#supported_options ⇒ Hash{Symbol => Array<String>, nil}
readonly
Option keys to allowed values (
nilmeans any boolean/toggle value is accepted).
Instance Method Summary collapse
-
#allowed_values(option_key) ⇒ Array<String>?
Allowed values, or nil for toggles/flags.
- #match?(bundler_version) ⇒ Boolean
- #supports_option?(option_key) ⇒ Boolean
Instance Attribute Details
#requirement ⇒ Gem::Requirement (readonly)
Returns Bundler version range this entry covers.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/create_ruby_gem/compatibility/matrix.rb', line 22 Entry = Struct.new(:requirement, :supported_options, keyword_init: true) do # @param bundler_version [Gem::Version] version to test # @return [Boolean] def match?(bundler_version) requirement.satisfied_by?(bundler_version) end # @param option_key [Symbol, String] # @return [Boolean] def supports_option?(option_key) .key?(option_key.to_sym) end # @param option_key [Symbol, String] # @return [Array<String>, nil] allowed values, or nil for toggles/flags def allowed_values(option_key) .fetch(option_key.to_sym) end end |
#supported_options ⇒ Hash{Symbol => Array<String>, nil} (readonly)
Returns option keys to allowed values (nil means any boolean/toggle value is accepted).
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/create_ruby_gem/compatibility/matrix.rb', line 22 Entry = Struct.new(:requirement, :supported_options, keyword_init: true) do # @param bundler_version [Gem::Version] version to test # @return [Boolean] def match?(bundler_version) requirement.satisfied_by?(bundler_version) end # @param option_key [Symbol, String] # @return [Boolean] def supports_option?(option_key) .key?(option_key.to_sym) end # @param option_key [Symbol, String] # @return [Array<String>, nil] allowed values, or nil for toggles/flags def allowed_values(option_key) .fetch(option_key.to_sym) end end |
Instance Method Details
#allowed_values(option_key) ⇒ Array<String>?
Returns allowed values, or nil for toggles/flags.
37 38 39 |
# File 'lib/create_ruby_gem/compatibility/matrix.rb', line 37 def allowed_values(option_key) .fetch(option_key.to_sym) end |
#match?(bundler_version) ⇒ Boolean
25 26 27 |
# File 'lib/create_ruby_gem/compatibility/matrix.rb', line 25 def match?(bundler_version) requirement.satisfied_by?(bundler_version) end |
#supports_option?(option_key) ⇒ Boolean
31 32 33 |
# File 'lib/create_ruby_gem/compatibility/matrix.rb', line 31 def supports_option?(option_key) .key?(option_key.to_sym) end |