Created
June 22, 2015 18:18
-
-
Save adrianpike/b25481938fed4209fd71 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
# https://blog.nvisium.com/2015/06/using-rails-5-attributes-api-today-in.html | |
class Foobar | |
def initialize | |
@foobar = '123' | |
end | |
end | |
def Foobar(obj) | |
case obj | |
when Foobar | |
obj | |
when String | |
Foobar.new(somestr) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment