Class: GitPusshuTen::Gem
- Inherits:
-
Object
- Object
- GitPusshuTen::Gem
- Defined in:
- lib/gitpusshuten/gem.rb
Instance Attribute Summary collapse
-
#gem ⇒ Object
Stores the JSON gem object from RubyGems.org.
Instance Method Summary collapse
-
#base_url ⇒ Object
Returns the base url to the RubyGems API.
-
#initialize(name) ⇒ Gem
constructor
Instantiates a new gem.
-
#latest_version ⇒ Object
Returns the latest version of the gem.
-
#outdated?(version) ⇒ Boolean
Checks to see if the provided version number is outdated.
Constructor Details
#initialize(name) ⇒ Gem
Instantiates a new gem
10 11 12 |
# File 'lib/gitpusshuten/gem.rb', line 10 def initialize(name) @gem = JSON.parse(open(File.join(base_url, "#{name}.json")).read) end |
Instance Attribute Details
#gem ⇒ Object
Stores the JSON gem object from RubyGems.org
6 7 8 |
# File 'lib/gitpusshuten/gem.rb', line 6 def gem @gem end |
Instance Method Details
#base_url ⇒ Object
Returns the base url to the RubyGems API
28 29 30 |
# File 'lib/gitpusshuten/gem.rb', line 28 def base_url "http://rubygems.org/api/v1/gems/" end |
#latest_version ⇒ Object
Returns the latest version of the gem
16 17 18 |
# File 'lib/gitpusshuten/gem.rb', line 16 def latest_version gem['version'] end |
#outdated?(version) ⇒ Boolean
Checks to see if the provided version number is outdated
22 23 24 |
# File 'lib/gitpusshuten/gem.rb', line 22 def outdated?(version) version < latest_version end |