Class: Mimas::Hooks

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

Constant Summary collapse

POINTS =
[ :before_push, :after_push ]

Instance Method Summary collapse

Constructor Details

#initializeHooks

Returns a new instance of Hooks.



5
6
7
# File 'lib/mimas/hooks.rb', line 5

def initialize
  @hooks = Hash[POINTS.zip([[], [], []])].freeze
end

Instance Method Details

#[](hook) ⇒ Object



9
10
11
# File 'lib/mimas/hooks.rb', line 9

def [](hook)
  @hooks[hook]
end

#merge(with_hooks) ⇒ Object



13
14
15
16
17
# File 'lib/mimas/hooks.rb', line 13

def merge(with_hooks)
  POINTS.each do |point|
    @hooks[point].push(*with_hooks[point])
  end
end