Last active
August 29, 2015 14:27
-
-
Save denysxftr/278a5a9e1fc33754b92c 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 SomeService | |
# http status of operation | |
attr_reader :status | |
# result of service work for example: { errors: { email: ['should not be empty'] }, user: { id: 32, email: nil, ... } } | |
attr_reader :result | |
def self.call(params) | |
new(params).perform! | |
end | |
def perform! | |
# logic goes here | |
@status = :ok | |
@result = some_result | |
end | |
private | |
def initialize(params) | |
# blablabla | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment