Sha256: c4b1ac7c7363bd2e60591a67b9f7063f54a9b8ce65f769587b428a620d244b9a

Contents?: true

Size: 479 Bytes

Versions: 2

Compression:

Stored size: 479 Bytes

Contents

module Captivus
  class Backtrace
    class Line
      PATTERN = /^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$/

      def initialize(raw_line)
        if match_data = PATTERN.match(raw_line)
          @as_json = {
            :file => match_data[1],
            :number => match_data[2].to_i,
            :method => match_data[3]
          }
        else
          raise ArgumentError, "Unrecognized format"
        end
      end

      attr_reader :as_json
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
captivus-0.0.3 lib/captivus/backtrace/line.rb
captivus-0.0.2 lib/captivus/backtrace/line.rb