Sha256: 8c4fdb4281e76a0fa816207f6972bb207b2c4372b253a498dfd750a023f45518

Contents?: true

Size: 323 Bytes

Versions: 23

Compression:

Stored size: 323 Bytes

Contents

module Lookbook
  class HookStore
    attr_reader :store
    delegate :to_h, to: :store

    def initialize(config = nil)
      @store = {}
    end

    def add_hook(event_name, callback)
      for_event(event_name) << callback
    end

    def for_event(event_name)
      store[event_name.to_sym] ||= []
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
lookbook-2.0.0.beta.7 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0.beta.6 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0.beta.5 lib/lookbook/stores/hook_store.rb