Class: DAP::Relation::OneOf

Inherits:
Object
  • Object
show all
Defined in:
lib/dap/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(types) ⇒ OneOf

Returns a new instance of OneOf.



18
19
20
21
# File 'lib/dap/relation.rb', line 18

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

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



16
17
18
# File 'lib/dap/relation.rb', line 16

def key
  @key
end

#typesObject (readonly)

Returns the value of attribute types.



16
17
18
# File 'lib/dap/relation.rb', line 16

def types
  @types
end

Instance Method Details

#[]=(k, v) ⇒ Object



29
30
31
# File 'lib/dap/relation.rb', line 29

def []=(k, v)
  @types[k] = v
end

#with(key) ⇒ Object



23
24
25
26
27
# File 'lib/dap/relation.rb', line 23

def with(key)
  o = dup
  o.instance_eval { @key = key }
  o
end