Class: Katagen::Generators::Solution
- Inherits:
-
Object
- Object
- Katagen::Generators::Solution
- Includes:
- Utils
- Defined in:
- lib/katagen/generators/solution.rb
Overview
Generates a solution package
Constant Summary
Constants included from Logging
Instance Method Summary collapse
-
#create_package ⇒ Object
Create the folder containing: solution.rb, solution_spec.rb (defaults to rb).
-
#initialize(strategy, options) ⇒ Solution
constructor
Initialize generator with chosen method.
Methods included from Utils
#generate_file, #generate_folder
Methods included from Logging
Constructor Details
#initialize(strategy, options) ⇒ Solution
Initialize generator with chosen method.
20 21 22 23 24 |
# File 'lib/katagen/generators/solution.rb', line 20 def initialize(strategy, ) @strategy = strategy @lang_ext = [:lang] || "rb" @cwd = [:cwd] || "./" end |
Instance Method Details
#create_package ⇒ Object
Create the folder containing: solution.rb, solution_spec.rb (defaults to rb)
31 32 33 34 35 36 37 |
# File 'lib/katagen/generators/solution.rb', line 31 def create_package question_info = @strategy.build_question_info root = File.(File.join(@cwd, question_info.root)) generate_folder(root) create_solution(root, question_info.url) create_solution_spec(root) end |