Module: Executable::Dispatch

Defined in:
lib/executable/dispatch.rb

Overview

Variation of Executable which provides basic compatibility with previous versions of Executable. It provides a call method that automatically dispatches to public methods.

Among other uses, Dispatch can be useful for dropping into any class as a quick and dirty way to work with it on the command line.

Since:

  • 1.2.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

When Dispatchable is included into a class, the class is also extended by ‘Executable::Domain`.

Since:

  • 1.2.0



18
19
20
# File 'lib/executable/dispatch.rb', line 18

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

Instance Method Details

#call(name, *args) ⇒ Object

Since:

  • 1.2.0



22
23
24
# File 'lib/executable/dispatch.rb', line 22

def call(name, *args)
  public_method(name).call(*args)
end