Module: CodeAIFactory
- Defined in:
- lib/asker/ai/code/code_ai_factory.rb
Overview
CodeAI factory
Class Method Summary collapse
-
.get(code) ⇒ Object
Return CodeAI associated to Code.type.
Class Method Details
.get(code) ⇒ Object
Return CodeAI associated to Code.type
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/asker/ai/code/code_ai_factory.rb', line 16 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 |