Class: RubyDep::RubyVersion
- Inherits:
-
Object
- Object
- RubyDep::RubyVersion
- Defined in:
- lib/ruby_dep/ruby_version.rb
Instance Attribute Summary collapse
-
#engine ⇒ Object
readonly
Returns the value of attribute engine.
-
#status ⇒ Object
readonly
NOTE: monkey-patched by acceptance tests.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(ruby_version, engine) ⇒ RubyVersion
constructor
A new instance of RubyVersion.
- #recognized? ⇒ Boolean
- #recommended(status) ⇒ Object
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
#engine ⇒ Object (readonly)
Returns the value of attribute engine.
6 7 8 |
# File 'lib/ruby_dep/ruby_version.rb', line 6 def engine @engine end |
#status ⇒ Object (readonly)
NOTE: monkey-patched by acceptance tests
4 5 6 |
# File 'lib/ruby_dep/ruby_version.rb', line 4 def status @status end |
#version ⇒ Object (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
14 15 16 |
# File 'lib/ruby_dep/ruby_version.rb', line 14 def recognized? info.any? end |
#recommended(status) ⇒ Object
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 |