Sha256: 3e21122660e6165e0f4c8ff9d24b49c1d032c36e12d51bf1f9e15043f9687606

Contents?: true

Size: 518 Bytes

Versions: 4

Compression:

Stored size: 518 Bytes

Contents

# frozen_string_literal: true

module AIRefactor
  module Refactors
    def get(name)
      all[name]
    end
    module_function :get

    def names
      all.keys
    end
    module_function :names

    def all
      @all ||= constants.map { |n| const_get(n) }.select { |c| c.is_a? Class }.each_with_object({}) do |klass, hash|
        hash[klass.refactor_name] = klass
      end
    end
    module_function :all

    def supported?(name)
      names.include?(name)
    end
    module_function :supported?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ai_refactor-0.3.1 lib/ai_refactor/refactors.rb
ai_refactor-0.3.0 lib/ai_refactor/refactors.rb
ai_refactor-0.2.0 lib/ai_refactor/refactors.rb
ai_refactor-0.1.0 lib/ai_refactor/refactors.rb