Skip to content

Instantly share code, notes, and snippets.

@tiagopog
Last active August 29, 2015 14:27
Show Gist options
  • Save tiagopog/7be7f8a1ea80b2249b7f to your computer and use it in GitHub Desktop.
Save tiagopog/7be7f8a1ea80b2249b7f to your computer and use it in GitHub Desktop.
Data objects - Virtus example
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