Sha256: f1a041af3aea78169c1ab2cf5b877a1d1fa69bc2df8a584cbc04281bacaf4dff
Contents?: true
Size: 1.3 KB
Versions: 6
Compression:
Stored size: 1.3 KB
Contents
require 'rack' require 'singleton' require 'logger' require 'hashie' require 'omnihooks/builder' require 'omnihooks/strategy' module OmniHooks module Strategies end # # Collection of current strategies # # @return [Array<Object>] strategy collection def self.strategies @strategies ||= [] end class Configuration include Singleton attr_accessor :logger, :path_prefix, :allowed_request_methods def self.default_logger logger = Logger.new(STDOUT) logger.progname = 'omnihooks' logger end def self.defaults @defaults ||= { logger: default_logger, path_prefix: '/hooks', allowed_request_methods: [:post] } end def initialize self.class.defaults.each_pair { |k, v| send("#{k}=", v) } end end def self.config Configuration.instance end def self.configure yield config end def self.logger config.logger end module Utils module_function def deep_merge(hash, other_hash) target = hash.dup other_hash.keys.each do |key| if other_hash[key].is_a?(::Hash) && hash[key].is_a?(::Hash) target[key] = deep_merge(target[key], other_hash[key]) next end target[key] = other_hash[key] end target end end end
Version data entries
6 entries across 6 versions & 1 rubygems