Class: Gem::StubSpecification::StubLine
- Inherits:
-
Object
- Object
- Gem::StubSpecification::StubLine
- Defined in:
- lib/rubygems/stub_specification.rb
Overview
:nodoc: all
Constant Summary collapse
- NO_EXTENSIONS =
[].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
Instance Attribute Summary collapse
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#full_name ⇒ Object
readonly
Returns the value of attribute full_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#require_paths ⇒ Object
readonly
Returns the value of attribute require_paths.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(data, extensions) ⇒ StubLine
constructor
A new instance of StubLine.
Constructor Details
#initialize(data, extensions) ⇒ StubLine
Returns a new instance of StubLine.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rubygems/stub_specification.rb', line 37 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 ⇒ Object (readonly)
Returns the value of attribute extensions
17 18 19 |
# File 'lib/rubygems/stub_specification.rb', line 17 def extensions @extensions end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name
17 18 19 |
# File 'lib/rubygems/stub_specification.rb', line 17 def full_name @full_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name
17 18 19 |
# File 'lib/rubygems/stub_specification.rb', line 17 def name @name end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform
17 18 19 |
# File 'lib/rubygems/stub_specification.rb', line 17 def platform @platform end |
#require_paths ⇒ Object (readonly)
Returns the value of attribute require_paths
17 18 19 |
# File 'lib/rubygems/stub_specification.rb', line 17 def require_paths @require_paths end |
#version ⇒ Object (readonly)
Returns the value of attribute version
17 18 19 |
# File 'lib/rubygems/stub_specification.rb', line 17 def version @version end |