Class: Plok::Search::ResultObjectGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/plok/search/result_object_generator.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/generators/plok/search/result_object_generator.rb', line 8

def create
  # TODO: Check for missing params
  copy_file 'result_object.rb', class_path
  gsub_file(class_path, '[name]', options.name)
  gsub_file(class_path, '[namespace]', options.namespace)
  gsub_file(class_path, '[class_name]', to_snakecase(options.name))
  gsub_file(class_path, '[namespace_module_name]', to_snakecase(options.namespace))

  copy_file 'result_object.html.erb', markup_path
  gsub_file(markup_path, '[name]', options.name)
end