Class: Kward::SourceOutline
- Inherits:
-
Object
- Object
- Kward::SourceOutline
- Defined in:
- lib/kward/source/outline.rb
Overview
Extracts locations from the current buffer without executing it.
Constant Summary collapse
- MAX_SOURCE_BYTES =
512 * 1024
- MAX_OUTPUT_BYTES =
1024 * 1024
- MAX_SYMBOLS =
2_000- TIME_LIMIT =
1.5
Instance Method Summary collapse
Instance Method Details
#symbols(path, content) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/kward/source/outline.rb', line 15 def symbols(path, content) return [] if content.bytesize > MAX_SOURCE_BYTES lines = content.scrub.lines = (path, content, lines.length) return unless .nil? || .empty? SourceDeclarations.scan(lines.map { |line| line.length <= 2_000 ? line : "" }).first(MAX_SYMBOLS) end |