class Axiom::Attribute::Relation
Represents a Relation
value in a relation tuple
Attributes
header[R]
The tuple header
@return [Header]
@api private
Public Class Methods
new(_name, options)
click to toggle source
Initialize a Relation
Attribute
@param [#to_sym] _name
the attribute name
@param [Hash] options
the options for the attribute
@option options [Boolean] :required (true)
if true, then the value cannot be nil
@option options [Header] :header
the header for the relation
@return [undefined]
@api private
Calls superclass method
Axiom::Attribute::new
# File lib/axiom/attribute/relation.rb, line 31 def initialize(_name, options) super @header = Axiom::Relation::Header.coerce(options.fetch(:header)) end
type()
click to toggle source
The attribute type
@example
type = Axiom::Attribute::Relation.type # => Axiom::Types::Relation
@return [Class<Types::Relation>]
@api public
# File lib/axiom/attribute/relation.rb, line 44 def self.type Types::Relation end
Public Instance Methods
new_relation(tuples)
click to toggle source
Initialize a new relation with the tuples provided
@example
relation = attribute.new_relation(tuples)
@param [Enumerable] tuples
@return [Relation]
@api public
# File lib/axiom/attribute/relation.rb, line 58 def new_relation(tuples) type.primitive.new(@header, tuples) end