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 18[].freeze
-
REQUIRE_PATHS =
These are common require paths.
{ # :nodoc: "lib" => "lib".freeze, "test" => "test".freeze, "ext" => "ext".freeze, }.freeze
-
REQUIRE_PATH_LIST =
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
- .new(data, extensions) ⇒ StubLine constructor
Instance Attribute Summary
- #extensions readonly
- #full_name readonly
- #name readonly
- #platform readonly
- #require_paths readonly
- #version readonly
Constructor Details
.new(data, extensions) ⇒ StubLine
# File 'lib/rubygems/stub_specification.rb', line 35
def initialize(data, extensions) parts = data[PREFIX.length..-1].split(" ".freeze, 4) @name = parts[0].freeze @version = if Gem::Version.correct?(parts[1]) Gem::Version.new(parts[1]) else Gem::Version.new(0) end @platform = Gem::Platform.new parts[2] @extensions = extensions @full_name = if platform == Gem::Platform::RUBY "#{name}-#{version}" else "#{name}-#{version}-#{platform}" end path_list = parts.last @require_paths = REQUIRE_PATH_LIST[path_list] || path_list.split("\0".freeze).map! do |x| REQUIRE_PATHS[x] || x end end
Instance Attribute Details
#extensions (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 15
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name
#full_name (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 15
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name
#name (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 15
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name
#platform (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 15
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name
#require_paths (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 15
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name
#version (readonly)
[ GitHub ]# File 'lib/rubygems/stub_specification.rb', line 15
attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name