Sha256: 92be704edaad110cb3a56af46e31382c4c96ea353dee679e55fd38e2a80de89e
Contents?: true
Size: 929 Bytes
Versions: 4
Compression:
Stored size: 929 Bytes
Contents
module Para class ExporterGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) argument :formats, type: :array desc 'Para exporter generator' 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/#{ plural_file_name }_exporter.rb" ) end end private def model_exporter_name Para::Exporter.model_exporter_name(class_name) end 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 end end
Version data entries
4 entries across 4 versions & 1 rubygems