Last active
August 29, 2015 14:27
-
-
Save tiagopog/7be7f8a1ea80b2249b7f to your computer and use it in GitHub Desktop.
Data objects - Virtus example
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
require 'virtus' | |
class User | |
include Virtus.model | |
attribute :name, String | |
attribute :age, Integer | |
attribute :birthday, Date | |
end | |
user = User.new(name: 'Tiago', age: 26, birthday: Date.new) | |
puts user.name, user.age, user.birthday |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment