class HamlLint::VersionComparer

A simple wrapper around Gem::Version to allow comparison with String instances This makes code shorter in some places

Public Class Methods

for_haml() click to toggle source
# File lib/haml_lint/version_comparer.rb, line 21
def self.for_haml
  new(Haml::VERSION)
end
for_rubocop() click to toggle source

Shortcut to create a version comparer for the current RuboCop’s version

# File lib/haml_lint/version_comparer.rb, line 17
def self.for_rubocop
  new(RuboCop::Version::STRING)
end
new(version) click to toggle source
# File lib/haml_lint/version_comparer.rb, line 7
def initialize(version)
  @version = Gem::Version.new(version)
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/haml_lint/version_comparer.rb, line 12
def <=>(other)
  @version <=> Gem::Version.new(other)
end