Sha256: bc26895ecabbc8bca053770f2b837597bfe8cda84b810f96a4eca02ef807f333
Contents?: true
Size: 562 Bytes
Versions: 5
Compression:
Stored size: 562 Bytes
Contents
# frozen_string_literal: true require 'rails/generators' module Rails class CommandGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) check_class_collision suffix: 'Command' def copy_files path = File.join('app', 'commands', class_path, "#{file_name}_command.rb") template('command.rb.tt', path) end private def file_name @_file_name ||= remove_possible_suffix(super) end def remove_possible_suffix(name) name.sub(/_?command$/i, '') end end end
Version data entries
5 entries across 5 versions & 1 rubygems