Sha256: acbaf7114e7313ceedc64deff02bac10c180c8f1a6e990bf609a813cf907d0bc
Contents?: true
Size: 574 Bytes
Versions: 2
Compression:
Stored size: 574 Bytes
Contents
# frozen_string_literal: true require 'rails/generators' module Rails class DecoratorGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) check_class_collision suffix: 'Decorator' def copy_files path = File.join('app', 'decorators', class_path, "#{file_name}_decorator.rb") template('decorator.rb.tt', path) end private def file_name @_file_name ||= remove_possible_suffix(super) end def remove_possible_suffix(name) name.sub(/_?decorator$/i, '') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lite-decorator-1.1.0 | lib/generators/rails/decorator_generator.rb |
lite-decorator-1.0.3 | lib/generators/rails/decorator_generator.rb |