Class: DependencyTimelineAudit::GemCache
- Inherits:
-
Object
- Object
- DependencyTimelineAudit::GemCache
- Defined in:
- lib/dependency-timeline-audit/gem_cache.rb
Instance Attribute Summary collapse
-
#versions ⇒ Object
readonly
Returns the value of attribute versions.
Instance Method Summary collapse
-
#initialize(gem_info) ⇒ GemCache
constructor
A new instance of GemCache.
- #latest_version ⇒ Object
- #to_h ⇒ Object
-
#version(version_number) ⇒ Object
Find the version that matches the requested version string.
Constructor Details
#initialize(gem_info) ⇒ GemCache
Returns a new instance of GemCache.
5 6 7 |
# File 'lib/dependency-timeline-audit/gem_cache.rb', line 5 def initialize(gem_info) @versions = gem_info || [] end |
Instance Attribute Details
#versions ⇒ Object (readonly)
Returns the value of attribute versions.
3 4 5 |
# File 'lib/dependency-timeline-audit/gem_cache.rb', line 3 def versions @versions end |
Instance Method Details
#latest_version ⇒ Object
9 10 11 12 |
# File 'lib/dependency-timeline-audit/gem_cache.rb', line 9 def latest_version latest = versions.first # The first entry is the latest version version_number = latest['number'] end |
#to_h ⇒ Object
20 21 22 |
# File 'lib/dependency-timeline-audit/gem_cache.rb', line 20 def to_h versions end |
#version(version_number) ⇒ Object
Find the version that matches the requested version string
15 16 17 18 |
# File 'lib/dependency-timeline-audit/gem_cache.rb', line 15 def version(version_number) version_info = versions.find { |v| v['number'] == version_number } GemVersionCache.new(version_info) end |