Class: Rubyist
- Inherits:
-
Object
- Object
- Rubyist
- Includes:
- Comparable
- Defined in:
- lib/rubyist.rb,
lib/rubyist/version.rb
Defined Under Namespace
Classes: Gem
Constant Summary collapse
- VERSION =
'0.1.1'
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #gems ⇒ Object
-
#initialize(name) ⇒ Rubyist
constructor
A new instance of Rubyist.
- #total_downloads ⇒ Object
Constructor Details
#initialize(name) ⇒ Rubyist
Returns a new instance of Rubyist.
9 10 11 |
# File 'lib/rubyist.rb', line 9 def initialize name @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/rubyist.rb', line 6 def name @name end |
Class Method Details
.own(gem_name) ⇒ Object
30 31 32 33 |
# File 'lib/rubyist.rb', line 30 def own gem_name Gems.owners(gem_name). map { |o| new o['handle'] } end |
Instance Method Details
#<=>(other) ⇒ Object
13 14 15 |
# File 'lib/rubyist.rb', line 13 def <=>(other) name <=> other.name end |
#gems ⇒ Object
17 18 19 20 21 |
# File 'lib/rubyist.rb', line 17 def gems return @gems if defined? @gems result = Gems.gems(name) @gems = (Hash === result ? [] : result.map { |g| Gem.new g }) end |
#total_downloads ⇒ Object
23 24 25 |
# File 'lib/rubyist.rb', line 23 def total_downloads gems.inject(0) { |sum, g| sum + g.total_downloads } end |