Class: Gem::Source::SpecificFile
- Inherits:
-
Gem::Source
- Object
- Gem::Source
- Gem::Source::SpecificFile
- Defined in:
- lib/rubygems/source_specific_file.rb
Constant Summary
Constants inherited from Gem::Source
Instance Attribute Summary collapse
-
#spec ⇒ Object
readonly
Returns the value of attribute spec.
Attributes inherited from Gem::Source
Instance Method Summary collapse
- #download(spec, dir = nil) ⇒ Object
- #fetch_spec(name) ⇒ Object
-
#initialize(file) ⇒ SpecificFile
constructor
A new instance of SpecificFile.
- #load_specs(*a) ⇒ Object
Methods inherited from Gem::Source
#<=>, #==, #api_uri, #cache_dir, #hash, #update_cache?
Constructor Details
#initialize(file) ⇒ SpecificFile
Returns a new instance of SpecificFile.
2 3 4 5 6 7 8 9 |
# File 'lib/rubygems/source_specific_file.rb', line 2 def initialize(file) @uri = nil @path = ::File.(file) @package = Gem::Package.new @path @spec = @package.spec @name = @spec.name_tuple end |
Instance Attribute Details
#spec ⇒ Object (readonly)
Returns the value of attribute spec.
11 12 13 |
# File 'lib/rubygems/source_specific_file.rb', line 11 def spec @spec end |
Instance Method Details
#download(spec, dir = nil) ⇒ Object
23 24 25 26 |
# File 'lib/rubygems/source_specific_file.rb', line 23 def download(spec, dir=nil) return @path if spec == @spec raise Gem::Exception, "Unable to download '#{spec.full_name}'" end |
#fetch_spec(name) ⇒ Object
17 18 19 20 21 |
# File 'lib/rubygems/source_specific_file.rb', line 17 def fetch_spec(name) return @spec if name == @name raise Gem::Exception, "Unable to find '#{name}'" @spec end |
#load_specs(*a) ⇒ Object
13 14 15 |
# File 'lib/rubygems/source_specific_file.rb', line 13 def load_specs(*a) [@name] end |