Sha256: b89551c7919ff81d8d999035f6d0d4dc7f4eda209c43de9f4deddd8fcca01bfe
Contents?: true
Size: 534 Bytes
Versions: 22
Compression:
Stored size: 534 Bytes
Contents
# frozen_string_literal: true 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
22 entries across 22 versions & 1 rubygems