Module: Axiom::Function::Unary::Callable

Included in:
Axiom::Function::Unary
Defined in:
lib/axiom/function/unary.rb

Overview

Mixin for adding #call to unary function classes

Instance Method Summary collapse

Instance Method Details

#call(value) ⇒ Object

Return the response from the unary operation called on the value

Examples:

callable.call(value)  # => any object

Parameters:

  • value (Object)

Returns:

  • (Object)


38
39
40
# File 'lib/axiom/function/unary.rb', line 38

def call(value)
  value.public_send(operation)
end

#included(descendant) ⇒ self

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.

Hook called when module is included

Parameters:

  • descendant (Module)

    the module or class including Callable

Returns:

  • (self)


22
23
24
25
26
# File 'lib/axiom/function/unary.rb', line 22

def included(descendant)
  super
  descendant.extend(Callable)
  self
end