Class: Gem::StubSpecification::StubLine
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/rubygems/stub_specification.rb |
Constant Summary
-
NO_EXTENSIONS =
# File 'lib/rubygems/stub_specification.rb', line 22[].freeze -
NO_TARGET =
# File 'lib/rubygems/stub_specification.rb', line 23{}.freeze -
REQUIRE_PATHS =
# File 'lib/rubygems/stub_specification.rb', line 26
These are common require paths.
{ # :nodoc: "lib" => "lib", "test" => "test", "ext" => "ext", }.freeze -
REQUIRE_PATH_LIST =
# File 'lib/rubygems/stub_specification.rb', line 36
These are common require path lists. This hash is used to optimize and consolidate require_path objects. Most specs just specify "lib" in their require paths, so lets take advantage of that by pre-allocating a require path list for that case.
{ # :nodoc: "lib" => ["lib"].freeze, }.freeze
Class Method Summary
Instance Attribute Summary
- #content_address readonly
- #extensions readonly
- #full_name readonly
- #name readonly
- #platform readonly
- #require_paths readonly
- #version readonly
Constructor Details
.new(data, extensions, target = NO_TARGET) ⇒ StubLine
# File 'lib/rubygems/stub_specification.rb', line 40
def initialize(data, extensions, target = NO_TARGET) parts = data[PREFIX.length..-1].split(" ", 4) @name = -parts[0] @version = if Gem::Version.correct?(parts[1]) Gem::Version.new(parts[1]) else Gem::Version.new(0) end suffix = parts[2] target_platform = target["platform"] @platform = Gem::Platform.new(target_platform || suffix) @content_address = suffix if Gem::ContentAddress.content_addressed_row?(suffix, target_platform, validate_ruby_abi: false) @extensions = extensions @full_name = if @content_address "#{name}-#{version}-#{content_address}" elsif platform == Gem::Platform::RUBY "#{name}-#{version}" else "#{name}-#{version}-#{suffix}" end path_list = parts.last @require_paths = REQUIRE_PATH_LIST[path_list] || path_list.split("\0").map! do |x| REQUIRE_PATHS[x] || x end end
Instance Attribute Details
#content_address (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 19
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name, :content_address
#extensions (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 19
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name, :content_address
#full_name (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 19
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name, :content_address
#name (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 19
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name, :content_address
#platform (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 19
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name, :content_address
#require_paths (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 19
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name, :content_address
#version (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 19
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name, :content_address