Hglib::

Extension

module
Extended With
Loggability

Public Class Methods

anchor
load_all()

Load all of the extensions.

# File lib/hglib/extension.rb, line 17
def self::load_all
        # :TODO: Allow gem extensions?
        extdir = Pathname( __FILE__ ).dirname + 'extension'
        Pathname.glob( extdir + '*.rb' ).each do |extpath|
                self.log.debug "Loading extensions from %s" % [ extpath ]
                require( extpath )
        end
end

Public Instance Methods

anchor
global_commands( &block )

Define one or more commands that should be attached to the Hglib module.

# File lib/hglib/extension.rb, line 39
def global_commands( &block )
        raise LocalJumpError, "no block given" unless block

        mod = Module.new
        mod.class_eval( &block )

        Hglib.extend( mod )
end
anchor
repo_commands( &block )

Define one or more commands that should be attached to Repo objects.

# File lib/hglib/extension.rb, line 28
def repo_commands( &block )
        raise LocalJumpError, "no block given" unless block

        mod = Module.new
        mod.class_eval( &block )

        Hglib::Repo.include( mod )
end