Sha256: eb4815ba179035b95098be58234196fc0b4f91a91651f7109ae483526c851c8e

Contents?: true

Size: 750 Bytes

Versions: 19

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

# Utility module which manages the creation of {HookContext}s.
module Overcommit::HookContext
  def self.create(hook_type, config, args, input)
    hook_type_class = Overcommit::Utils.camel_case(hook_type)
    underscored_hook_type = Overcommit::Utils.snake_case(hook_type)

    require "overcommit/hook_context/#{underscored_hook_type}"

    Overcommit::HookContext.const_get(hook_type_class).new(config, args, input)
  rescue LoadError, NameError => error
    # Could happen when a symlink was created for a hook type Overcommit does
    # not yet support.
    raise Overcommit::Exceptions::HookContextLoadError,
          "Unable to load '#{hook_type}' hook context: '#{error}'",
          error.backtrace
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
overcommit-0.58.0 lib/overcommit/hook_context.rb
overcommit-0.57.0 lib/overcommit/hook_context.rb
overcommit-0.56.0 lib/overcommit/hook_context.rb
overcommit-0.55.0 lib/overcommit/hook_context.rb
overcommit-0.54.1 lib/overcommit/hook_context.rb
overcommit-0.54.0 lib/overcommit/hook_context.rb
overcommit-jeygeethanmedia-0.53.1.2 lib/overcommit/hook_context.rb
overcommit-jeygeethanmedia-0.53.1.1 lib/overcommit/hook_context.rb
overcommit-jeygeethanmedia-0.53.1 lib/overcommit/hook_context.rb
overcommit-0.53.0 lib/overcommit/hook_context.rb
overcommit-0.52.1 lib/overcommit/hook_context.rb
overcommit-0.52.0 lib/overcommit/hook_context.rb
overcommit-0.51.0 lib/overcommit/hook_context.rb
overcommit-0.50.0 lib/overcommit/hook_context.rb
overcommit-0.49.1 lib/overcommit/hook_context.rb
overcommit-0.49.0 lib/overcommit/hook_context.rb
overcommit-0.48.1 lib/overcommit/hook_context.rb
overcommit-0.48.0 lib/overcommit/hook_context.rb
overcommit-0.47.0 lib/overcommit/hook_context.rb