| 1 | module Groonga |
| 2 | class BacktraceEntry |
| 3 | class << self |
| 4 | def parse(entry) |
| 5 | match_data = /:(\d+):?/.match(entry) |
| 6 | file = match_data.pre_match |
| 7 | line = match_data[1].to_i |
| 8 | detail_match_data = /\A(in )?(\S+)\s*/.match(match_data.post_match) |
| 9 | if detail_match_data and detail_match_data[1] |
| 10 | method = detail_match_data[2] |
| 11 | message = detail_match_data.post_match |
| 12 | else |
| 13 | method = "" |
| 14 | message = match_data.post_match |
| 15 | end |
| 16 | new(file, line, method, message) |
| 17 | end |
| 18 | end |
| 19 | |
| 20 | attr_reader :file, :line, :method, :message |
| 21 | def initialize(file, line, method, message) |
| 22 | @file = file |
| 23 | @line = line |
| 24 | @method = method |
| 25 | @message = message |
| 26 | end |
| 27 | end |
| 28 | end |