Class: Appraisal::Matrix::AppraiseFileWithMatrix::VersionArray

Inherits:
Object
  • Object
show all
Defined in:
lib/appraisal/matrix/extensions/appraisal_file.rb

Constant Summary collapse

SUPPORTED_VERSION_STEPS =
[:major, :minor, :patch].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_name:, versions:, step: :minor) ⇒ VersionArray

Returns a new instance of VersionArray.



14
15
16
17
18
19
20
# File 'lib/appraisal/matrix/extensions/appraisal_file.rb', line 14

def initialize(gem_name:, versions:, step: :minor)
  SUPPORTED_VERSION_STEPS.include?(step) or raise("Unsupported version step: #{step}")

  @gem_name = gem_name
  @version_requirements = Gem::Requirement.new(versions)
  @step = step.to_sym
end

Instance Attribute Details

#gem_nameObject (readonly)

Returns the value of attribute gem_name.



12
13
14
# File 'lib/appraisal/matrix/extensions/appraisal_file.rb', line 12

def gem_name
  @gem_name
end

#stepObject (readonly)

Returns the value of attribute step.



12
13
14
# File 'lib/appraisal/matrix/extensions/appraisal_file.rb', line 12

def step
  @step
end

#version_requirementsObject (readonly)

Returns the value of attribute version_requirements.



12
13
14
# File 'lib/appraisal/matrix/extensions/appraisal_file.rb', line 12

def version_requirements
  @version_requirements
end

Instance Method Details

#versionsObject



22
23
24
# File 'lib/appraisal/matrix/extensions/appraisal_file.rb', line 22

def versions
  RubygemsHelper.versions_to_test(gem_name, version_requirements, step)
end