Module: Evilution::MCP::InfoTool::RequestParser Private
- Defined in:
- lib/evilution/mcp/info_tool/request_parser.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Classes: ParsedPaths
Class Method Summary collapse
- .parse_files(raw_files) ⇒ Object private
- .parse_line_range(str) ⇒ Object private
Class Method Details
.parse_files(raw_files) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/evilution/mcp/info_tool/request_parser.rb', line 10 def parse_files(raw_files) files = [] ranges = {} raw_files.each do |arg| file, range_str = arg.split(":", 2) files << file ranges[file] = parse_line_range(range_str) if range_str end ParsedPaths.new(files: files, ranges: ranges) end |
.parse_line_range(str) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/evilution/mcp/info_tool/request_parser.rb', line 23 def parse_line_range(str) if str.include?("-") start_str, end_str = str.split("-", 2) start_line = Integer(start_str) end_line = end_str.empty? ? Float::INFINITY : Integer(end_str) start_line..end_line else line = Integer(str) line..line end rescue ArgumentError, TypeError raise Evilution::ParseError, "invalid line range: #{str.inspect}" end |