Created
June 27, 2017 18:25
-
-
Save ryenski/72cad7bebc04c48908ed226398515188 to your computer and use it in GitHub Desktop.
Calling a service object
This file contains hidden or 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 UserCreator | |
# ... | |
# UserCreator.new(params).call | |
def call | |
do_the_work(args) | |
end | |
# Alternatively some people think this reads nicer: | |
# UserCreateor.call(params) | |
def self.call(*args) | |
new(*args).call | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment