Created
July 2, 2015 02:13
-
-
Save pumpkincouture/3e1c73a1b98b74b61494 to your computer and use it in GitHub Desktop.
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
class Field | |
attr_reader :name, | |
:label, | |
:validation_strategy, | |
:valid_values, | |
:value, | |
:error | |
def initialize(name, label, validation_strategy, valid_values = []) | |
@name = name | |
@label = label | |
@validation_strategy = validation_strategy | |
@valid_values = valid_values | |
end | |
def validate(value) | |
@value = value | |
@error = validation_strategy.check_for_errors(value) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment