Sha256: 2dd1b8796dc2ee4af34cdf949fd2d0c49179f6e8b73765dc20086bf4052fd16f

Contents?: true

Size: 591 Bytes

Versions: 33

Compression:

Stored size: 591 Bytes

Contents

module CC
  module Analyzer
    class EngineOutput
      delegate :blank?, to: :raw_output
      delegate :to_json, to: :as_issue

      def initialize(raw_output)
        @raw_output = raw_output
      end

      def issue?
        parsed_output &&
          parsed_output["type"].present? &&
          parsed_output["type"].downcase == "issue"
      end

      def as_issue
        Issue.new(raw_output)
      end

      private

      attr_accessor :raw_output

      def parsed_output
        JSON.parse(raw_output)
      rescue JSON::ParserError
        nil
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
codeclimate-0.24.3 lib/cc/analyzer/engine_output.rb
codeclimate-0.24.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.24.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.24.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.23.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.22.3 lib/cc/analyzer/engine_output.rb
codeclimate-0.22.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.22.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.22.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.21.4 lib/cc/analyzer/engine_output.rb
codeclimate-0.21.3 lib/cc/analyzer/engine_output.rb
codeclimate-0.21.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.21.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.21.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.20.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.20.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.20.0 lib/cc/analyzer/engine_output.rb
codeclimate-0.19.2 lib/cc/analyzer/engine_output.rb
codeclimate-0.19.1 lib/cc/analyzer/engine_output.rb
codeclimate-0.19.0 lib/cc/analyzer/engine_output.rb