Class: AllGems::Specer

Inherits:
Object
  • Object
show all
Defined in:
lib/allgems/Specer.rb

Class Method Summary collapse

Class Method Details

.get_spec(gem, version = nil) ⇒ Object



4
5
6
7
8
9
# File 'lib/allgems/Specer.rb', line 4

def get_spec(gem, version=nil)
    spec = AllGems.db[:specs].join(:versions, :id => :version_id).join(:gems, :id => :gem_id).filter(:name => gem)
    spec = spec.filter(:version => version) if version
    spec = spec.order(:version.desc).limit(1).first
    return spec ? Marshal.load(spec[:spec].unpack('m')[0]) : nil
end