class Mercurial::HookFactory
This class is a handy way to manage hooks in your repository.
Attributes
repository[R]
Instance of {Mercurial::Repository Repository}.
Public Class Methods
new(repository)
click to toggle source
# File lib/mercurial-ruby/factories/hook_factory.rb, line 11 def initialize(repository) @repository = repository end
Public Instance Methods
add(name, value)
click to toggle source
all()
click to toggle source
Finds all repository hooks. Returns an array of {Mercurial::Hook Hook} instances.
Example:¶ ↑
repository.hooks.all
# File lib/mercurial-ruby/factories/hook_factory.rb, line 21 def all [].tap do |returning| repository.config.find_header('hooks').each_pair do |name, value| returning << build(name, value) end end end
by_name(name)
click to toggle source
Protected Instance Methods
build(name, value)
click to toggle source
# File lib/mercurial-ruby/factories/hook_factory.rb, line 67 def build(name, value) Mercurial::Hook.new(repository, name, value) end