Class: RubyDep::RubyVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_dep/ruby_version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruby_version, engine) ⇒ RubyVersion

Returns a new instance of RubyVersion.



8
9
10
11
12
# File 'lib/ruby_dep/ruby_version.rb', line 8

def initialize(ruby_version, engine)
  @engine = engine
  @version = Gem::Version.new(ruby_version)
  @status = detect_status
end

Instance Attribute Details

#engineObject (readonly)

Returns the value of attribute engine.



6
7
8
# File 'lib/ruby_dep/ruby_version.rb', line 6

def engine
  @engine
end

#statusObject (readonly)

NOTE: monkey-patched by acceptance tests



4
5
6
# File 'lib/ruby_dep/ruby_version.rb', line 4

def status
  @status
end

#versionObject (readonly)

Returns the value of attribute version.



5
6
7
# File 'lib/ruby_dep/ruby_version.rb', line 5

def version
  @version
end

Instance Method Details

#recognized?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/ruby_dep/ruby_version.rb', line 14

def recognized?
  info.any?
end


18
19
20
21
22
23
# File 'lib/ruby_dep/ruby_version.rb', line 18

def recommended(status)
  current = Gem::Version.new(@version)
  info.select do |key, value|
    value == status && Gem::Version.new(key) > current
  end.keys.reverse
end