Created
October 13, 2017 21:16
-
-
Save lubekpl/0530f912438f6a69b98833c642657128 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ServiceGenerator < Rails::Generators::NamedBase | |
source_root File.expand_path('../templates', __FILE__) | |
def copy_service_file | |
template "service.rb", "app/services/#{file_name}.rb" | |
end | |
def copy_service_spec_file | |
template "service_spec.rb", "spec/services/#{file_name}_spec.rb" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class <%= class_name %> | |
def initialize(*args) | |
end | |
def call | |
end | |
def self.call(*args) | |
new(args).call | |
end | |
private_class_method :new | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment