Sha256: 7c9281918a38625a9867ef8fc9e1476873a2dd72a3e06c6c1136e47a9411ab59

Contents?: true

Size: 312 Bytes

Versions: 7

Compression:

Stored size: 312 Bytes

Contents

class SchemaSerializer
  class Definition
    attr_reader :schemas

    def initialize(hash)
      @schemas = hash.each_with_object({}) { |(name, schema), obj|
        obj[name.to_s] = Schema.new(schema)
      }
    end

    def schema(name)
      schemas[name] || (raise SchemaNotFound, name)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
schema_serializer-0.2.2 lib/schema_serializer/definition.rb
schema_serializer-0.2.1 lib/schema_serializer/definition.rb
schema_serializer-0.2.0 lib/schema_serializer/definition.rb
schema_serializer-0.1.3 lib/schema_serializer/definition.rb
schema_serializer-0.1.2 lib/schema_serializer/definition.rb
schema_serializer-0.1.1 lib/schema_serializer/definition.rb
schema_serializer-0.1.0 lib/schema_serializer/definition.rb