Class: SemverDialects::Commands::CheckVersion
- Inherits:
-
SemverDialects::Command
- Object
- SemverDialects::Command
- SemverDialects::Commands::CheckVersion
- Defined in:
- lib/semver_dialects/commands/check_version.rb
Overview
The check version command implementation
Instance Method Summary collapse
- #execute(_input: $stdin, output: $stdout) ⇒ Object
-
#initialize(type, version, constraint, options) ⇒ CheckVersion
constructor
rubocop:todo Lint/MissingSuper.
Methods inherited from SemverDialects::Command
#command, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(type, version, constraint, options) ⇒ CheckVersion
rubocop:todo Lint/MissingSuper
10 11 12 13 14 15 |
# File 'lib/semver_dialects/commands/check_version.rb', line 10 def initialize(type, version, constraint, ) # rubocop:todo Lint/MissingSuper @type = type @version = version @constraint = constraint @options = end |
Instance Method Details
#execute(_input: $stdin, output: $stdout) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/semver_dialects/commands/check_version.rb', line 17 def execute(_input: $stdin, output: $stdout) typ = @type.downcase if SemverDialects.version_satisfies?(typ, @version, @constraint) output.puts "#{@version} matches #{@constraint} for #{@type}" 0 else output.puts "#{@version} does not match #{@constraint}" 1 end end |