Skip to content

Instantly share code, notes, and snippets.

@mariorcardoso
Last active June 25, 2017 18:41
Show Gist options
  • Save mariorcardoso/0691cce28b9d0587d264c2036cf2d7b5 to your computer and use it in GitHub Desktop.
Save mariorcardoso/0691cce28b9d0587d264c2036cf2d7b5 to your computer and use it in GitHub Desktop.
class Size
SIZES = %w(small medium big)
attr_reader :size
def initialize(size)
@size = size
end
def self.to_select
SIZES.map{|c| [c.capitalize, c]}
end
def valid?
SIZES.include?(size)
end
def to_s
size.capitalize
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment