Sha256: 37f9d91421ffab076cd0f67a1f0929e14417afb37c0b446041ee9c1059f27f9d

Contents?: true

Size: 801 Bytes

Versions: 30

Compression:

Stored size: 801 Bytes

Contents

require 'rainbow'
require_relative 'javascript_code_ai'
require_relative 'problem_code_ai'
require_relative 'python_code_ai'
require_relative 'ruby_code_ai'
require_relative 'sql_code_ai'

##
# CodeAI factory
module CodeAIFactory
  ##
  # Return CodeAI associated to Code.type
  # @param code (Code)
  # @return CodeAI
  def self.get(code)
    type = code.type
    case type
    when :javascript
      return JavascriptCodeAI.new(code)
    when :problem
      return ProblemCodeAI.new(code)
    when :python
      return PythonCodeAI.new(code)
    when :ruby
      return RubyCodeAI.new(code)
    when :sql
      return SQLCodeAI.new(code)
    when :vagrantfile
      return RubyCodeAI.new(code)
    else
      puts Rainbow("[ERROR] <#{type}> is not valid type").red.bright
    end
    nil
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
asker-tool-2.6.0 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.9 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.8 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.7 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.6 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.5 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.4 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.3 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.2 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.1 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.5.0 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.4.5 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.4.4 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.4.3 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.4.2 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.4.1 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.4.0 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.3.4 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.3.3 lib/asker/ai/code/code_ai_factory.rb
asker-tool-2.3.2 lib/asker/ai/code/code_ai_factory.rb