Class: ViewGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/view/view_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



7
8
9
# File 'lib/generators/view/view_generator.rb', line 7

def self.source_root
  @source_root ||= File.expand_path("../templates", __FILE__)
end

Instance Method Details

#add_helper_methodObject



11
12
13
14
15
16
17
# File 'lib/generators/view/view_generator.rb', line 11

def add_helper_method  
  if File.exist?(view_file_name)
    inject_into_file(view_file_name, view_code, :after => after_txt) if after_txt
  else
    say "#{view_file_name} does not exist. Please create it first before you can add view code to it!", :red
  end
end