class Bare::Schema

Public Class Methods

new(types) click to toggle source
# File lib/bare-rb.rb, line 52
def initialize(types)
  @types = types
  @types.keys.each do |key|
    if @types[key].is_a?(Symbol)
      @types[key] = @types[@types[key]]
    else
      # Users may use symbols to reference not yet defined types
      # here we recursively call our bare classes to finalize their types
      # replacing Symbols like :SomeType with a reference to the other type
      @types[key].finalize_references(@types)
    end
  end
end

Public Instance Methods

==(otherSchema) click to toggle source
# File lib/bare-rb.rb, line 39
def ==(otherSchema)
  return false unless otherSchema.is_a?(Bare::Schema)
  @types == otherSchema.types
end
[](key) click to toggle source
# File lib/bare-rb.rb, line 48
def [](key)
  return @types[key]
end
types() click to toggle source
# File lib/bare-rb.rb, line 44
def types
  @types
end