Sha256: 63d6faf55156e6d63ed4d1b9bec421566d95254f124941c13821fb136308a8f5

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require 'attractor/version'
require 'attractor/calculators/base_calculator'
require 'attractor/calculators/ruby_calculator'
require 'attractor/calculators/js_calculator'
require 'attractor/detectors/base_detector'
require 'attractor/detectors/ruby_detector'
require 'attractor/detectors/js_detector'
require 'attractor/reporters/base_reporter'
require 'attractor/reporters/console_reporter'
require 'attractor/reporters/html_reporter'
require 'attractor/reporters/sinatra_reporter'
require 'attractor/suggester'
require 'attractor/watcher'

module Attractor
  class Error < StandardError; end

  def calculators_for_type(type, file_prefix)
    case type
    when 'js'
      { 'js' => JsCalculator.new(file_prefix: file_prefix) }
    when 'rb'
      { 'rb' => RubyCalculator.new(file_prefix: file_prefix) }
    else
      {}.tap do |hash|
        hash['rb'] = RubyCalculator.new(file_prefix: file_prefix) if RubyDetector.new.detect
        hash['js'] = JsCalculator.new(file_prefix: file_prefix) if JsDetector.new.detect
      end
    end
  end

  module_function :calculators_for_type
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attractor-1.1.0 lib/attractor.rb