Class: FullMetalBody::InputValidation
- Inherits:
-
Object
- Object
- FullMetalBody::InputValidation
- Includes:
- ActiveModel::Validations, InputKeyUtils
- Defined in:
- lib/full_metal_body/input_validation.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#key_type ⇒ Object
Returns the value of attribute key_type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, value, whitelist) ⇒ InputValidation
constructor
A new instance of InputValidation.
Constructor Details
#initialize(key, value, whitelist) ⇒ InputValidation
Returns a new instance of InputValidation.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/full_metal_body/input_validation.rb', line 22 def initialize(key, value, whitelist) @key = key @value = value set_key_type(whitelist) if value_validate class_eval %( validates :value, #{value_validate} # validates :value, input_string: true ), __FILE__, __LINE__ - 2 end end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
15 16 17 |
# File 'lib/full_metal_body/input_validation.rb', line 15 def key @key end |
#key_type ⇒ Object
Returns the value of attribute key_type.
15 16 17 |
# File 'lib/full_metal_body/input_validation.rb', line 15 def key_type @key_type end |
#value ⇒ Object
Returns the value of attribute value.
15 16 17 |
# File 'lib/full_metal_body/input_validation.rb', line 15 def value @value end |