Class: BundleLock::GemDependency
- Inherits:
-
Object
- Object
- BundleLock::GemDependency
- Defined in:
- lib/bundle_lock/gem_dependency.rb
Constant Summary collapse
- VERSION_REGEXP =
/^([\(])(.+?)(?:-.+)?([\)])$/
Instance Attribute Summary collapse
-
#handwaving ⇒ Object
readonly
Returns the value of attribute handwaving.
-
#name ⇒ Object
Returns the value of attribute name.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #handwaving? ⇒ Boolean
-
#initialize(gemfile_string) ⇒ GemDependency
constructor
GEMNAME_REGEXP = /s()(.+?)1/.
- #latest_version ⇒ Object
- #outdated? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(gemfile_string) ⇒ GemDependency
GEMNAME_REGEXP = /s()(.+?)1/
8 9 10 |
# File 'lib/bundle_lock/gem_dependency.rb', line 8 def initialize(gemfile_string) self.name, self.version = gemfile_string.split(/\s/) end |
Instance Attribute Details
#handwaving ⇒ Object (readonly)
Returns the value of attribute handwaving.
3 4 5 |
# File 'lib/bundle_lock/gem_dependency.rb', line 3 def handwaving @handwaving end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/bundle_lock/gem_dependency.rb', line 3 def name @name end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/bundle_lock/gem_dependency.rb', line 3 def version @version end |
Instance Method Details
#handwaving? ⇒ Boolean
27 |
# File 'lib/bundle_lock/gem_dependency.rb', line 27 def handwaving?; !!handwaving; end |
#latest_version ⇒ Object
33 34 35 |
# File 'lib/bundle_lock/gem_dependency.rb', line 33 def latest_version @latest_version ||= Gem.latest_version_for(name) end |
#outdated? ⇒ Boolean
37 38 39 40 |
# File 'lib/bundle_lock/gem_dependency.rb', line 37 def outdated? return false unless version && latest_version version < latest_version end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/bundle_lock/gem_dependency.rb', line 29 def to_s "#{name}, Version: #{ version || 'Any' }" end |