Module: RDoc::SourceCodeAccess

Included in:
AnyMethod, Attr
Defined in:
lib/rdoc/generator/shomen_extensions.rb

Instance Method Summary collapse

Instance Method Details

#source_code_locationObject



71
72
73
74
75
76
77
78
79
80
81
# File 'lib/rdoc/generator/shomen_extensions.rb', line 71

def source_code_location
  src = source_code_raw
  if md = /File (.*?), line (\d+)/.match(src)
    file = md[1]
    line = md[2]
  else
    file = "(unknown)"
    line = 0
  end
  return file, line
end

#source_code_rawObject



59
60
61
62
63
64
65
66
67
68
# File 'lib/rdoc/generator/shomen_extensions.rb', line 59

def source_code_raw
  return '' unless @token_stream
  src = ""
  @token_stream.each do |t|
    next unless t
    src << t.text
  end
  #add_line_numbers(src)
  src
end