class Para::ExporterGenerator

Public Instance Methods

copy_resource_exporter() click to toggle source
# File lib/generators/para/exporter/exporter_generator.rb, line 9
def copy_resource_exporter
  formats.each do |format|
    # Set the format to be accessible by the template to define its
    # class name
    @format = format

    template(
      "#{ base_exporter_template_name_for(format) }_exporter.rb",
      "app/exporters/#{ exporter_name }.rb"
    )
  end
end

Private Instance Methods

base_exporter_template_name_for(format) click to toggle source
# File lib/generators/para/exporter/exporter_generator.rb, line 32
def base_exporter_template_name_for(format)
  format_specific_template = "../templates/#{ format }_exporter.rb"

  if File.exists?(File.expand_path(format_specific_template, __FILE__))
    format
  else
    'base'
  end
end
exporter_class_name() click to toggle source
# File lib/generators/para/exporter/exporter_generator.rb, line 24
def exporter_class_name
  exporter_name.camelize
end
exporter_name() click to toggle source
# File lib/generators/para/exporter/exporter_generator.rb, line 28
def exporter_name
  [plural_file_name, 'exporter'].join('_')
end