Class: Parrot::Generators::ParrotGenerator

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

Instance Method Summary collapse

Instance Method Details

#inject_parrot_contentObject



14
15
16
# File 'lib/generators/parrot/parrot_generator.rb', line 14

def inject_parrot_content
  inject_into_class(model_path, class_name, "  parrot_comments\n\n") if model_exists?
end

#model_exists?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/generators/parrot/parrot_generator.rb', line 6

def model_exists?
  File.exists?(File.join(destination_root, model_path))
end

#model_pathObject



10
11
12
# File 'lib/generators/parrot/parrot_generator.rb', line 10

def model_path
  @model_path ||= File.join("app", "models", "#{file_path}.rb")
end