Created
September 26, 2013 10:39
-
-
Save jjuarez/6712504 to your computer and use it in GitHub Desktop.
This cook works well for default parameters
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 YourClass | |
DEFAUL_PARAMETER_VALUE = :foo | |
def your_method(parameter, options={ }) | |
options = { :default_parameter =>DEFAULT_PARAMETER_VALUE }.merge(options) | |
# Do something with this | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment