Sha256: b262ec004761fb39ba2c9faec9844768f0e6d5fac7a78d497fd628523a262a87

Contents?: true

Size: 828 Bytes

Versions: 8

Compression:

Stored size: 828 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

    def runner_patterns
      Runner::PATTERNS
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lamby-3.1.3 lib/lamby/config.rb
lamby-3.1.2 lib/lamby/config.rb
lamby-3.1.1 lib/lamby/config.rb
lamby-3.1.0 lib/lamby/config.rb
lamby-3.0.3 lib/lamby/config.rb
lamby-3.0.2 lib/lamby/config.rb
lamby-3.0.1 lib/lamby/config.rb
lamby-3.0.0 lib/lamby/config.rb