Last active
October 1, 2018 18:39
-
-
Save mrjonesbot/b8194d6ace04ef448a2b40cce101fde8 to your computer and use it in GitHub Desktop.
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 DefaultUser | |
| attr_reader :params | |
| def initialize(params) | |
| @params = params | |
| end | |
| def create | |
| User.create(default_user_params) | |
| end | |
| def default_user_params | |
| clean_params.merge(defaults) | |
| end | |
| def clean_params | |
| # do some stuff to incoming params | |
| end | |
| def defaults | |
| { | |
| number: 0.0, | |
| address: build_address, | |
| } | |
| end | |
| def build_address | |
| # some logic to build an address | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment