Class: SectionGenerator

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

Overview

Generates a new section.

Instance Method Summary collapse

Instance Method Details

#create_coffee_fileObject



18
19
20
21
# File 'lib/generators/section_generator.rb', line 18

def create_coffee_file
  create_file "#{@section.asset_filepath}.coffee",
              "class #{@section.filename}\n  # Your CoffeeScript code goes here.\n"
end

#create_folderObject



9
10
11
# File 'lib/generators/section_generator.rb', line 9

def create_folder
  empty_directory @section.folder_filepath
end

#create_partialObject



13
14
15
16
# File 'lib/generators/section_generator.rb', line 13

def create_partial
  create_file "#{@section.partial_filepath}.html.haml",
              ".#{@section.filename}\n  -# DOM content goes here.\n"
end

#create_sass_fileObject



23
24
25
26
# File 'lib/generators/section_generator.rb', line 23

def create_sass_file
  create_file "#{@section.asset_filepath}.sass",
              ".#{@section.filename}\n  /* Your SASS goes here. */\n"
end

#parse_argumentsObject



5
6
7
# File 'lib/generators/section_generator.rb', line 5

def parse_arguments
  @section = SectionsRails::Section.new name
end