Class: Outdated::RubyGems::Spec
- Inherits:
-
Object
- Object
- Outdated::RubyGems::Spec
- Includes:
- Comparable
- Defined in:
- lib/outdated/ruby_gems/spec.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#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.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(args) ⇒ Spec
constructor
A new instance of Spec.
Constructor Details
#initialize(args) ⇒ Spec
Returns a new instance of Spec.
15 16 17 18 19 20 21 22 23 |
# File 'lib/outdated/ruby_gems/spec.rb', line 15 def initialize(args) @created_at = args[:created_at] or raise ArgumentError, "missing created_at" @name = args[:name] or raise ArgumentError, "missing name" @prerelease = args[:prerelease] raise ArgumentError, "missing prerelease" if @prerelease.nil? @version = args[:version] or raise ArgumentError, "missing version" end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
13 14 15 |
# File 'lib/outdated/ruby_gems/spec.rb', line 13 def created_at @created_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/outdated/ruby_gems/spec.rb', line 13 def name @name end |
#prerelease ⇒ Object (readonly)
Returns the value of attribute prerelease.
13 14 15 |
# File 'lib/outdated/ruby_gems/spec.rb', line 13 def prerelease @prerelease end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
13 14 15 |
# File 'lib/outdated/ruby_gems/spec.rb', line 13 def version @version end |
Class Method Details
.from_response_object(name, response_object) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/outdated/ruby_gems/spec.rb', line 6 def self.from_response_object(name, response_object) Outdated::RubyGems::Spec.new(created_at: response_object['created_at'].to_time, name: name, prerelease: response_object['prerelease'], version: ::Gem::Version.new(response_object['number'])) end |
Instance Method Details
#<=>(other) ⇒ Object
25 26 27 |
# File 'lib/outdated/ruby_gems/spec.rb', line 25 def <=>(other) version <=> other.version end |