Last active
June 25, 2017 18:41
-
-
Save mariorcardoso/0691cce28b9d0587d264c2036cf2d7b5 to your computer and use it in GitHub Desktop.
This file contains 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
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