Class: Bundler::AsOf::ReleaseWrapper
- Inherits:
-
Object
- Object
- Bundler::AsOf::ReleaseWrapper
- Defined in:
- lib/bundler/as_of.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prerelease ⇒ Object
readonly
Returns the value of attribute prerelease.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #dependencies ⇒ Object
- #gem_info ⇒ Object
- #gem_url ⇒ Object
-
#initialize(name, release_json) ⇒ ReleaseWrapper
constructor
A new instance of ReleaseWrapper.
- #to_s ⇒ Object
Constructor Details
#initialize(name, release_json) ⇒ ReleaseWrapper
Returns a new instance of ReleaseWrapper.
113 114 115 116 117 118 |
# File 'lib/bundler/as_of.rb', line 113 def initialize(name, release_json) @name = name @version = Gem::Version.new(release_json["number"]) @date = Date.parse(release_json["created_at"]) @prerelease = release_json["prerelease"] end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
112 113 114 |
# File 'lib/bundler/as_of.rb', line 112 def date @date end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
112 113 114 |
# File 'lib/bundler/as_of.rb', line 112 def name @name end |
#prerelease ⇒ Object (readonly)
Returns the value of attribute prerelease.
112 113 114 |
# File 'lib/bundler/as_of.rb', line 112 def prerelease @prerelease end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
112 113 114 |
# File 'lib/bundler/as_of.rb', line 112 def version @version end |
Instance Method Details
#dependencies ⇒ Object
124 125 126 |
# File 'lib/bundler/as_of.rb', line 124 def dependencies gem_info.find { |info| info[:number] == version.to_s }[:dependencies] || [] end |
#gem_info ⇒ Object
128 129 130 |
# File 'lib/bundler/as_of.rb', line 128 def gem_info @gem_info ||= Marshal.load(::URI.parse(gem_url).open.read) end |
#gem_url ⇒ Object
132 133 134 |
# File 'lib/bundler/as_of.rb', line 132 def gem_url @gem_url ||= "https://rubygems.org/api/v1/dependencies?gems=#{name}" end |
#to_s ⇒ Object
120 121 122 |
# File 'lib/bundler/as_of.rb', line 120 def to_s [name, version.to_s, date.to_s, prerelease, dependencies.to_s].to_s end |