Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class UserCreateService
def initialize(params)
@params = params
end
def call
return false unless valid?
process_user_data
end
def valid?
validator = assign_validator
validator.new(params).validate
end
def assign_validator
if some_condition
AdvancedUserValidator
else
SimpleUserValidator
end
end
def process_user_data
...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment