Class: Pry::CInternals::SymbolExtractor

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-doc/pry_ext/show_source_with_c_internals/symbol_extractor.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruby_source_folder) ⇒ SymbolExtractor

Returns a new instance of SymbolExtractor.



8
9
10
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/symbol_extractor.rb', line 8

def initialize(ruby_source_folder)
  @ruby_source_folder = ruby_source_folder
end

Class Attribute Details

.file_cacheObject

Returns the value of attribute file_cache.



4
5
6
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/symbol_extractor.rb', line 4

def file_cache
  @file_cache
end

Instance Method Details

#extract(info) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pry-doc/pry_ext/show_source_with_c_internals/symbol_extractor.rb', line 12

def extract(info)
  case info.symbol_type
  when :macro
    extract_macro(info)
  when :struct, :enum
    extract_struct(info)
  when :typedef_struct
    extract_typedef_struct(info)
  when :typedef_oneliner
    extract_oneliner(info)
  when :function
    extract_function(info)
  else
    # if we dont know what it is, just extract out a single line
    extract_oneliner(info)
  end
end