Skip to content

Instantly share code, notes, and snippets.

@ryenski
Created June 27, 2017 18:25
Show Gist options
  • Save ryenski/72cad7bebc04c48908ed226398515188 to your computer and use it in GitHub Desktop.
Save ryenski/72cad7bebc04c48908ed226398515188 to your computer and use it in GitHub Desktop.
Calling a service object
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