Class: FuncBot::FunctionGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- FuncBot::FunctionGenerator
- Defined in:
- lib/generators/func_bot/function_generator.rb
Instance Method Summary collapse
Instance Method Details
#append_to_functions_list ⇒ Object
11 12 13 14 15 |
# File 'lib/generators/func_bot/function_generator.rb', line 11 def append_to_functions_list yml = YAML.load_file(yml_file) yml["functions"] << function_template File.write(yml_file, yml.to_yaml.gsub("---\n", "")) end |
#generate_function ⇒ Object
5 6 7 8 9 |
# File 'lib/generators/func_bot/function_generator.rb', line 5 def generate_function template "function.rb", "app/lib/func_bot/functions/#{file_name}_function.rb" template "function_spec.rb", "spec/models/func_bot/functions/#{file_name}_function_spec.rb" if defined?(RSpec) puts "Update the function list file at lib/func_bot/functions/list.yml with the details of your new function." end |