Module PromoteSelf
In: lib/facets/more/promoteself.rb

PromoteSelf

PromoteSelf converts a module‘s class methods into instance methods such that the first parameter is passed self at the instance level. This promotes DRY programming when wishing to offer both an inheritable and a module callable procedure.

Usage

  module MyModule
    extend PromoteSelf
    def self.jumble( obj, arg )
      obj + arg
    end
  end

  class String
    include MyModule
  end

  MyModule.jumble( "Try", "Me" )  #=> "TryMe"

  "Try".jumble( "Me" )            #=> 'TryMe'

Methods

External Aliases

singleton_method_added -> singleton_method_added_promoteself

Public Instance methods

[Validate]