Sha256: 92eff367f179927cf9787b847def830befde0263cf8ed9208dd20a0f65d930f5

Contents?: true

Size: 772 Bytes

Versions: 3

Compression:

Stored size: 772 Bytes

Contents

module Lamby
  module Config

    def configure
      yield(config)
      config
    end

    def reconfigure
      config.reconfigure { |c| yield(c) if block_given? }
    end

    def config
      @config ||= Configuration.new
    end

    extend self

  end

  class Configuration

    def initialize
      initialize_defaults
    end

    def reconfigure
      instance_variables.each { |var| instance_variable_set var, nil }
      initialize_defaults
      yield(self) if block_given?
      self
    end

    def initialize_defaults
      @event_bridge_handler = lambda { |event, context| puts(event) }
    end

    def event_bridge_handler
      @event_bridge_handler
    end

    def event_bridge_handler=(func)
      @event_bridge_handler = func
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lamby-2.8.0 lib/lamby/config.rb
lamby-2.7.1 lib/lamby/config.rb
lamby-2.7.0 lib/lamby/config.rb