Class: RSchema::EnumSchema
- Inherits:
-
Struct
- Object
- Struct
- RSchema::EnumSchema
- Defined in:
- lib/rschema.rb
Instance Attribute Summary collapse
-
#subschema ⇒ Object
Returns the value of attribute subschema.
-
#value_set ⇒ Object
Returns the value of attribute value_set.
Instance Method Summary collapse
Instance Attribute Details
#subschema ⇒ Object
Returns the value of attribute subschema
212 213 214 |
# File 'lib/rschema.rb', line 212 def subschema @subschema end |
#value_set ⇒ Object
Returns the value of attribute value_set
212 213 214 |
# File 'lib/rschema.rb', line 212 def value_set @value_set end |
Instance Method Details
#schema_walk(value, mapper) ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/rschema.rb', line 213 def schema_walk(value, mapper) value_walked = if subschema v, error = RSchema.walk(subschema, value, mapper) return error if error v else value end if value_set.include?(value_walked) value_walked else RSchema::ErrorDetails.new(value_walked, "#{value_walked} is not a valid enum member") end end |