Class: ConvenientService::Dependencies::Queries::Version

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/convenient_service/dependencies/queries/version.rb,
lib/convenient_service/dependencies/queries/version/null_version.rb

Defined Under Namespace

Classes: NullVersion

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ void

Parameters:

  • value (String)


19
20
21
# File 'lib/convenient_service/dependencies/queries/version.rb', line 19

def initialize(value)
  @value = value
end

Class Method Details

.null_versionConvenientService::Dependencies::Queries::Version::NullVersion



27
28
29
# File 'lib/convenient_service/dependencies/queries/version.rb', line 27

def null_version
  @null_version ||= Version::NullVersion.new
end

Instance Method Details

#<=>(other) ⇒ Boolean?

Parameters:

  • other (Object)

    Can be any type.

Returns:

  • (Boolean, nil)


60
61
62
# File 'lib/convenient_service/dependencies/queries/version.rb', line 60

def <=>(other)
  gem_version <=> cast_gem_version(other)
end

#gem_versionGem::Version?

Returns:

  • (Gem::Version, nil)


42
43
44
# File 'lib/convenient_service/dependencies/queries/version.rb', line 42

def gem_version
  cast_gem_version(value)
end

#major_minorString

Returns:

  • (String)


52
53
54
# File 'lib/convenient_service/dependencies/queries/version.rb', line 52

def major_minor
  to_s[/\d+\.\d+/]
end

#null_version?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/convenient_service/dependencies/queries/version.rb', line 35

def null_version?
  false
end

#to_sString

Returns:

  • (String)


67
68
69
# File 'lib/convenient_service/dependencies/queries/version.rb', line 67

def to_s
  gem_version.to_s
end