Module: RDoc::SourceCodeAccess

Included in:
AnyMethod, Attr
Defined in:
lib/shomen/rdoc/extensions.rb

Instance Method Summary collapse

Instance Method Details

#source_code_locationObject



64
65
66
67
68
69
70
71
72
73
74
# File 'lib/shomen/rdoc/extensions.rb', line 64

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



52
53
54
55
56
57
58
59
60
61
# File 'lib/shomen/rdoc/extensions.rb', line 52

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