Skip to content

Instantly share code, notes, and snippets.

@adrianpike
Created June 22, 2015 18:18
Show Gist options
  • Save adrianpike/b25481938fed4209fd71 to your computer and use it in GitHub Desktop.
Save adrianpike/b25481938fed4209fd71 to your computer and use it in GitHub Desktop.
# 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