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", "test" => "test", "ext" => "ext", }.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.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rubygems/stub_specification.rb', line 36 def initialize(data, extensions) 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 @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").map! do |x| REQUIRE_PATHS[x] || x end end |
Instance Attribute Details
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
16 17 18 |
# File 'lib/rubygems/stub_specification.rb', line 16 def extensions @extensions end |
#full_name ⇒ Object (readonly)
Returns the value of attribute full_name.
16 17 18 |
# File 'lib/rubygems/stub_specification.rb', line 16 def full_name @full_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/rubygems/stub_specification.rb', line 16 def name @name end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
16 17 18 |
# File 'lib/rubygems/stub_specification.rb', line 16 def platform @platform end |
#require_paths ⇒ Object (readonly)
Returns the value of attribute require_paths.
16 17 18 |
# File 'lib/rubygems/stub_specification.rb', line 16 def require_paths @require_paths end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
16 17 18 |
# File 'lib/rubygems/stub_specification.rb', line 16 def version @version end |