Module: HatiCommand::Callee

Defined in:
lib/hati_command/callee.rb

Overview

Module for adding callable functionality to a class. This module implements the callable pattern, allowing classes to be called like functions while maintaining object-oriented principles.

Examples:

class MyCallable
  include HatiCommand::Callee

  def call(input)
    # Process input
    input.upcase
  end
end

# Can be used as:
result = MyCallable.call("hello")  # => "HELLO"

# Or with a block:
MyCallable.call("hello") do |instance|
  instance.configure(some: :option)
end

Defined Under Namespace

Modules: CalleeClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ void

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.

This method returns an undefined value.

Extends the including class with callable functionality

Parameters:

  • base (Class)

    The class including this module



33
34
35
# File 'lib/hati_command/callee.rb', line 33

def self.included(base)
  base.extend(CalleeClassMethods)
end

.whoamiString

Note:

This is a work in progress method

Returns the identity of the module

Returns:

  • (String)

    The module’s identity string



41
42
43
# File 'lib/hati_command/callee.rb', line 41

def self.whoami
  'My Name is Callee'
end