Module: AIRefactor::Refactors

Defined in:
lib/ai_refactor/refactors.rb,
lib/ai_refactor/refactors/custom.rb,
lib/ai_refactor/refactors/base_refactor.rb,
lib/ai_refactor/refactors/ruby/write_rbs.rb,
lib/ai_refactor/refactors/ruby/write_ruby.rb,
lib/ai_refactor/refactors/ruby/refactor_ruby.rb,
lib/ai_refactor/refactors/rspec/minitest_to_rspec.rb,
lib/ai_refactor/refactors/minitest/write_test_for_class.rb,
lib/ai_refactor/refactors/rails/minitest/rspec_to_minitest.rb,
lib/ai_refactor/refactors/project/write_changelog_from_history.rb

Defined Under Namespace

Modules: Minitest, Project, Rails, Rspec, Ruby Classes: BaseRefactor, Custom

Class Method Summary collapse

Class Method Details

.allObject



30
31
32
# File 'lib/ai_refactor/refactors.rb', line 30

def all
  @all ||= {}
end

.descriptionsObject



20
21
22
# File 'lib/ai_refactor/refactors.rb', line 20

def descriptions
  names.map { |n| "\"#{n}\"" }.zip(all.values.map(&:description)).to_h
end

.get(name) ⇒ Object



10
11
12
# File 'lib/ai_refactor/refactors.rb', line 10

def get(name)
  all[name]
end

.namesObject



15
16
17
# File 'lib/ai_refactor/refactors.rb', line 15

def names
  all.keys
end

.register(klass) ⇒ Object



5
6
7
# File 'lib/ai_refactor/refactors.rb', line 5

def register(klass)
  all[klass.refactor_name] = klass
end

.supported?(name) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/ai_refactor/refactors.rb', line 25

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