Class: Pry::CInternals::ETagParser
- Inherits:
-
Object
- Object
- Pry::CInternals::ETagParser
- Defined in:
- lib/pry-doc/pry_ext/show_source_with_c_internals/c_file.rb,
lib/pry-doc/pry_ext/show_source_with_c_internals/etag_parser.rb
Defined Under Namespace
Classes: CFile, SourceLocation
Instance Attribute Summary collapse
-
#ruby_source_folder ⇒ Object
readonly
Returns the value of attribute ruby_source_folder.
-
#tags_path ⇒ Object
readonly
Returns the value of attribute tags_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(tags_path, ruby_source_folder) ⇒ ETagParser
constructor
A new instance of ETagParser.
- #symbol_map ⇒ Object
Constructor Details
#initialize(tags_path, ruby_source_folder) ⇒ ETagParser
Returns a new instance of ETagParser.
14 15 16 17 |
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/etag_parser.rb', line 14 def initialize(, ruby_source_folder) @tags_path = @ruby_source_folder = ruby_source_folder end |
Instance Attribute Details
#ruby_source_folder ⇒ Object (readonly)
Returns the value of attribute ruby_source_folder.
8 9 10 |
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/etag_parser.rb', line 8 def ruby_source_folder @ruby_source_folder end |
#tags_path ⇒ Object (readonly)
Returns the value of attribute tags_path.
7 8 9 |
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/etag_parser.rb', line 7 def @tags_path end |
Class Method Details
.symbol_map_for(tags_path, ruby_source_folder) ⇒ Object
10 11 12 |
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/etag_parser.rb', line 10 def self.symbol_map_for(, ruby_source_folder) new(, ruby_source_folder).symbol_map end |
Instance Method Details
#symbol_map ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/etag_parser.rb', line 19 def symbol_map parse_tagfile.each_with_object({}) do |c_file, hash| # Append all the SourceLocations for a symbol to the same array # e.g # { "foo" => [SourceLocation_1] } # { "foo" => [SourceLocation_2] } # => { "foo" => [SourceLocation_1, SourceLocation_2] } hash.merge!(c_file.symbol_map) { |key, old_val, new_val| old_val + new_val } end end |