Class: Topaz::Specification

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

Class Method Summary collapse

Class Method Details

.method_missing(id, *args) ⇒ Object

Retrieves a gem with the name of ‘gem`, and optionally with the version of `version`.



155
156
157
158
159
# File 'lib/topaz.rb', line 155

def method_missing(id, *args)
	return unless args.length == 2 or args.length == 1
	args[1] ||= '> 0.0.0'
	eval('specification(args[0], args[1]).' + id.to_s)
end

.specification(gem, version = '> 0.0.0') ⇒ Object

Retrieve a specification object for the gem ‘gem`. Optionally a version can be specified with `version`. Returns a Gem::Specification instance.



149
150
151
# File 'lib/topaz.rb', line 149

def specification(gem, version = '> 0.0.0')
	spec = Gem::SourceIndex.from_installed_gems.search(gem, version).first
end