Class: GitPusshuTen::Gem

Inherits:
Object
  • Object
show all
Defined in:
lib/gitpusshuten/gem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#gemObject

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_urlObject

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_versionObject

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

Returns:

  • (Boolean)


22
23
24
# File 'lib/gitpusshuten/gem.rb', line 22

def outdated?(version)
  version < latest_version
end