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:

  • the current value of subschema



200
201
202
# File 'lib/rschema.rb', line 200

def subschema
  @subschema
end

Instance Method Details

#inspectObject



213
214
215
# File 'lib/rschema.rb', line 213

def inspect
  "set_of(#{subschema.inspect})"
end

#schema_walk(value, mapper) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
# File 'lib/rschema.rb', line 201

def schema_walk(value, mapper)
  return RSchema::ErrorDetails.new(value, '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 error.extend_key_path('.values') if error

    accum << subvalue_walked
    accum
  end
end