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.3.4 lib/lookbook/stores/hook_store.rb
lookbook-2.3.3 lib/lookbook/stores/hook_store.rb
lookbook-2.3.2 lib/lookbook/stores/hook_store.rb
lookbook-2.3.0 lib/lookbook/stores/hook_store.rb
lookbook-2.2.2 lib/lookbook/stores/hook_store.rb
lookbook-2.2.1 lib/lookbook/stores/hook_store.rb
lookbook-2.2.0 lib/lookbook/stores/hook_store.rb
lookbook-2.1.1 lib/lookbook/stores/hook_store.rb
lookbook-2.1.0 lib/lookbook/stores/hook_store.rb
lookbook-2.0.5 lib/lookbook/stores/hook_store.rb
lookbook-2.0.4 lib/lookbook/stores/hook_store.rb
lookbook-2.0.3 lib/lookbook/stores/hook_store.rb
lookbook-2.0.2 lib/lookbook/stores/hook_store.rb
lookbook-2.0.1 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0.rc.3 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0.rc.2 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0.rc.1 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0.beta.9 lib/lookbook/stores/hook_store.rb
lookbook-2.0.0.beta.8 lib/lookbook/stores/hook_store.rb