Class: RSchema::GenericSetSchema

Inherits:
Struct
  • Object
show all
Defined in:
lib/rschema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#subschemaObject

Returns the value of attribute subschema

Returns:

  • (Object)

    the current value of subschema



158
159
160
# File 'lib/rschema.rb', line 158

def subschema
  @subschema
end

Instance Method Details

#schema_walk(value, mapper) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
# File 'lib/rschema.rb', line 159

def schema_walk(value, mapper)
  return RSchema::ErrorDetails.new('is not a Set') if not value.is_a?(Set)

  value.reduce(Set.new) do |accum, subvalue|
    subvalue_walked, error = RSchema.walk(subschema, subvalue, mapper)
    break RSchema::ErrorDetails.new(Set.new([error.details])) if error

    accum << subvalue_walked
    accum
  end
end