Class: Mutant::Hooks::Builder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/mutant/hooks.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initializeBuilder

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.

Returns a new instance of Builder.



44
45
46
# File 'lib/mutant/hooks.rb', line 44

def initialize
  @map = DEFAULTS.transform_values(&:dup)
end

Instance Method Details

#register(name, &block) ⇒ 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.



48
49
50
51
52
53
54
# File 'lib/mutant/hooks.rb', line 48

def register(name, &block)
  Hooks.assert_name(name)

  @map.fetch(name) << block

  self
end

#to_hooksObject

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.



56
57
58
# File 'lib/mutant/hooks.rb', line 56

def to_hooks
  Hooks.new(@map.transform_values(&:freeze).freeze)
end