Sha256: 160fc3ab39efa2d557ea75a9daec44a410fa068f5aadd1ad9e4fea196ece65b7

Contents?: true

Size: 512 Bytes

Versions: 2

Compression:

Stored size: 512 Bytes

Contents

module DAP::Relation
  def self.supported!(klazz)
    raise "Unsupported property class #{klazz}" unless klazz < DAP::Base || klazz < DAP::Enum
  end

  class Many
    attr_reader :klazz

    def initialize(klazz)
      DAP::Relation.supported!(klazz)
      @klazz = klazz
    end
  end

  class OneOf
    attr_reader :types, :key

    def initialize(types)
      types.values.each { |k| DAP::Relation.supported!(k) }
      @types = types
    end

    def with(key)
      @key = key
      self
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-dap-0.1.1 lib/dap/relation.rb
ruby-dap-0.1.0 lib/dap/relation.rb