Class: Axiom::Attribute::Tuple

Inherits:
Object show all
Defined in:
lib/axiom/attribute/tuple.rb

Overview

Represents a tuple value in a relation tuple

Constant Summary

Constants inherited from Axiom::Attribute

FalseClass, TrueClass

Instance Attribute Summary collapse

Attributes inherited from Axiom::Attribute

#name, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Function::Predicate::Equality::Methods

#eq

Methods included from Function::Predicate::Exclusion::Methods

#exclude

Methods included from Function::Predicate::Inequality::Methods

#ne

Methods included from Function::Predicate::Inclusion::Methods

#include

Methods included from Axiom::Aggregate::Count::Methods

#count

Methods inherited from Axiom::Attribute

#call, coerce, #include?, infer_type, name_from, #optional?, #rename, #required?

Methods included from Axiom::Aliasable

#inheritable_alias

Methods included from Visitable

#accept

Constructor Details

#initialize(_name, options) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a Tuple Attribute

Parameters:

  • _name (#to_sym)

    the attribute name

  • options (Hash)

    the options for the attribute

Options Hash (options):

  • :required (Boolean) — default: true

    if true, then the value cannot be nil

  • :header (Header)

    the header for the tuple



31
32
33
34
# File 'lib/axiom/attribute/tuple.rb', line 31

def initialize(_name, options)
  super
  @header = Axiom::Relation::Header.coerce(options.fetch(:header))
end

Instance Attribute Details

#headerHeader (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The header

Returns:

  • (Header)


15
16
17
# File 'lib/axiom/attribute/tuple.rb', line 15

def header
  @header
end

Class Method Details

.typeClass<Types::Tuple>

The attribute type

Examples:

type = Axiom::Attribute::Tuple.type  # => Axiom::Types::Tuple

Returns:



44
45
46
# File 'lib/axiom/attribute/tuple.rb', line 44

def self.type
  Types::Tuple
end