Skip to content

Instantly share code, notes, and snippets.

@pumpkincouture
Created July 2, 2015 02:13
Show Gist options
  • Save pumpkincouture/3e1c73a1b98b74b61494 to your computer and use it in GitHub Desktop.
Save pumpkincouture/3e1c73a1b98b74b61494 to your computer and use it in GitHub Desktop.
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