Class: RequestMigrations::Version::Constraint
- Inherits:
-
Object
- Object
- RequestMigrations::Version::Constraint
- Defined in:
- lib/request_migrations/version.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(constraint) ⇒ Constraint
constructor
A new instance of Constraint.
- #satisfies?(other) ⇒ Boolean
Constructor Details
#initialize(constraint) ⇒ Constraint
Returns a new instance of Constraint.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/request_migrations/version.rb', line 49 def initialize(constraint) @format = RequestMigrations.config.version_format.to_sym @constraint = case @format when :semver Semverse::Constraint.coerce(constraint) when :date, :integer, :float, :string raise NotImplementedError, "#{@format} constraints are not supported" else raise InvalidVersionFormatError, "invalid version constraint format: #{@format} (must be one of: #{SUPPORTED_VERSION_FORMATS.join(',')}" end end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
46 47 48 |
# File 'lib/request_migrations/version.rb', line 46 def format @format end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
46 47 48 |
# File 'lib/request_migrations/version.rb', line 46 def value @value end |
Instance Method Details
#satisfies?(other) ⇒ Boolean
64 |
# File 'lib/request_migrations/version.rb', line 64 def satisfies?(other) = @constraint.satisfies?(other) |