Class: Rubyist::Gem
Defined Under Namespace
Classes: Version
Instance Attribute Summary collapse
-
#homepage_uri ⇒ Object
readonly
Returns the value of attribute homepage_uri.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#project_uri ⇒ Object
readonly
Returns the value of attribute project_uri.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(hash) ⇒ Gem
constructor
A new instance of Gem.
- #total_downloads ⇒ Object
- #versions ⇒ Object
Constructor Details
#initialize(hash) ⇒ Gem
Returns a new instance of Gem.
40 41 42 43 |
# File 'lib/rubyist.rb', line 40 def initialize hash @name, @info, @homepage_uri, @project_uri = %w[name info homepage_uri project_uri].map { |k| hash[k] } end |
Instance Attribute Details
#homepage_uri ⇒ Object (readonly)
Returns the value of attribute homepage_uri.
37 38 39 |
# File 'lib/rubyist.rb', line 37 def homepage_uri @homepage_uri end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
37 38 39 |
# File 'lib/rubyist.rb', line 37 def info @info end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/rubyist.rb', line 37 def name @name end |
#project_uri ⇒ Object (readonly)
Returns the value of attribute project_uri.
37 38 39 |
# File 'lib/rubyist.rb', line 37 def project_uri @project_uri end |
Instance Method Details
#<=>(other) ⇒ Object
45 46 47 |
# File 'lib/rubyist.rb', line 45 def <=>(other) name <=> other.name end |
#total_downloads ⇒ Object
53 54 55 |
# File 'lib/rubyist.rb', line 53 def total_downloads versions.inject(0) { |sum, v| sum + v.downloads } end |