Created
January 14, 2013 10:50
-
-
Save scudelletti/4529250 to your computer and use it in GitHub Desktop.
Ruby Method Initialize
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
def initialize(opts) | |
opts.each do |opt,val| | |
instance_variable_set("@#{opt}", val.to_s) if respond_to? opt | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment