Sha256: 217714946792a7160cb7118859c97f310ccc90a9a5b2700a863fad92e5dea3c8

Contents?: true

Size: 311 Bytes

Versions: 4

Compression:

Stored size: 311 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

4 entries across 4 versions & 1 rubygems

Version Path
schema_serializer-0.0.10 lib/schema_serializer/definition.rb
schema_serializer-0.0.9 lib/schema_serializer/definition.rb
schema_serializer-0.0.8 lib/schema_serializer/definition.rb
schema_serializer-0.0.7 lib/schema_serializer/definition.rb