class Axiom::Function

Abstract base class for logical functions

Public Class Methods

extract_value(operand, tuple) click to toggle source

Extract the value from the operand or tuple

@param [Object, call] operand

the operand to extract the value from

@param [Tuple] tuple

the tuple to pass in to the operand if it responds to #call

@return [Object]

@api private

# File lib/axiom/function.rb, line 41
def self.extract_value(operand, tuple)
  operand.respond_to?(:call) ? operand.call(tuple) : operand
end
rename_attributes(operand, aliases) click to toggle source

Rename the attribute(s) inside the function

@param [Function] operand

@param [Algebra::Rename::Aliases] aliases

@return [Function]

@todo simplify once Attribute#rename works the same as Function#rename

@api private

# File lib/axiom/function.rb, line 23
def self.rename_attributes(operand, aliases)
  if operand.respond_to?(:rename) && !operand.kind_of?(Attribute)
    operand.rename(aliases)
  else
    aliases[operand]
  end
end

Public Instance Methods

type() click to toggle source

Return the function type

@example

type = function.type  # => Axiom::Types::Object

@return [Class<Types::Object>]

@api public

# File lib/axiom/function.rb, line 53
def type
  self.class.type
end