module Axiom::Function::Unary
Mixin for unary functions
Public Instance Methods
call(tuple)
click to toggle source
Evaluate the unary connective using the tuple
@example
unary.call(tuple) # => true or false
@param [Tuple] tuple
the tuple to pass to operand#call
@return [Boolean]
@api public
# File lib/axiom/function/unary.rb, line 57 def call(tuple) util = self.class util.call(util.extract_value(operand, tuple)) end
rename(aliases)
click to toggle source
Rename the contained attributes with the provided aliases
@example
renamed = unary.rename(aliases)
@param [Algebra::Rename::Aliases] aliases
the old and new attributes
@return [self]
if the operand is not renamed
@return [Unary]
if the operand is renamed
@todo handle case where operand is a literal
@api public
# File lib/axiom/function/unary.rb, line 78 def rename(aliases) util = self.class renamed_operand = util.rename_attributes(operand, aliases) if operand.equal?(renamed_operand) self else util.new(renamed_operand) end end
type()
click to toggle source
Return the type returned from call
@example
type = unary.type # => Axiom::Types::Numeric
@return [Class<Types::Numeric>]
@api public
# File lib/axiom/function/unary.rb, line 97 def type Attribute.infer_type(operand) end