Module: ToProcInterface::Singleton

Includes:
ToProcInterface
Defined in:
lib/to_proc_interface/singleton.rb

Overview

Singleton variation. Mixin#to_proc & Mixin#call delegated to ClassMethods.instance

Examples:

Usage

require "to_proc_interface/singleton"

class Sum
  include ToProcInterface::Singleton

  def call(a, b)
    a + b
  end
end

Sum.(1, 2) # => 3

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from ToProcInterface

METHODS, VERSION

Instance Attribute Summary

Attributes included from Mixin

#to_proc

Class Method Summary collapse

Methods included from ToProcInterface

loader

Methods included from Mixin

#call

Class Method Details

.included(base) ⇒ Object

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.



24
25
26
27
28
# File 'lib/to_proc_interface/singleton.rb', line 24

def self.included(base)
  super
  base.include ::Singleton
  base.extend ClassMethods
end