Sha256: db561cd78c3e2890a2bca41769510a3a6bd736a505f7fee349af5189a7ed82c8

Contents?: true

Size: 769 Bytes

Versions: 6

Compression:

Stored size: 769 Bytes

Contents

require 'stringio'
require 'tempfile'
require 'forwardable'
require 'codeqa/utils/check_errors'

module Codeqa
  class Checker
    extend ::Forwardable

    def initialize(sourcefile)
      @errors = CheckErrors.new
      @sourcefile = sourcefile
    end

    attr_reader :sourcefile
    attr_reader :errors
    def_delegators :@errors, :success?, :errors?

    def self.available?
      true
    end

  private

    def with_existing_file(content=sourcefile.content)
      if sourcefile.exist? && sourcefile.content == content
        yield sourcefile.filename
      else
        Tempfile.open('codeqa') do |tmpfile|
          tmpfile.write(content)
          tmpfile.flush
          tmpfile.rewind
          yield tmpfile.path
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
codeqa-0.5.0 lib/codeqa/checker.rb
codeqa-0.4.2 lib/codeqa/checker.rb
codeqa-0.4.1 lib/codeqa/checker.rb
codeqa-0.4.0 lib/codeqa/checker.rb
codeqa-0.4.0.pre2 lib/codeqa/checker.rb
codeqa-0.4.0.pre lib/codeqa/checker.rb