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.



48
49
50
# File 'lib/mutant/hooks.rb', line 48

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.



52
53
54
55
56
57
58
# File 'lib/mutant/hooks.rb', line 52

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.



60
61
62
# File 'lib/mutant/hooks.rb', line 60

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