Sha256: 3dc2d148a62b0eefd25433837c61965f0db6783fe2624dd0bcc9360f18a835af

Contents?: true

Size: 439 Bytes

Versions: 3

Compression:

Stored size: 439 Bytes

Contents

# frozen_string_literal: true

module Trifle
  module Logs
    class Result
      attr_reader :min_loc, :max_loc

      def initialize(lines = [], min_loc: nil, max_loc: nil)
        @lines = lines
        @min_loc = min_loc
        @max_loc = max_loc
      end

      def meta
        @lines.last || {}
      end

      def data
        meta.dig('data', 'stats', 'matches').to_i.positive? ? @lines[1..-3] : []
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trifle-logs-0.2.1 lib/trifle/logs/result.rb
trifle-logs-0.2.0 lib/trifle/logs/result.rb
trifle-logs-0.1.0 lib/trifle/logs/result.rb