Class: 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.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# 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 ⇒ Object (readonly)
Returns the value of attribute extensions.
15 16 17 |
# File 'lib/rubygems/stub_specification.rb', line 15 def extensions @extensions end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
15 16 17 |
# File 'lib/rubygems/stub_specification.rb', line 15 def full_name @full_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/rubygems/stub_specification.rb', line 15 def name @name end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
15 16 17 |
# File 'lib/rubygems/stub_specification.rb', line 15 def platform @platform end |
#require_paths ⇒ Object (readonly)
Returns the value of attribute require_paths.
15 16 17 |
# File 'lib/rubygems/stub_specification.rb', line 15 def require_paths @require_paths end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
15 16 17 |
# File 'lib/rubygems/stub_specification.rb', line 15 def version @version end |