Sha256: 33d563ed420f2a9d25705f8875a74d005dd651e230d9387cf921f713a943fca8

Contents?: true

Size: 392 Bytes

Versions: 51

Compression:

Stored size: 392 Bytes

Contents

require 'ostruct'

module TxCatcher

  class << (Config = OpenStruct.new)
    def [](key_chain)
      key_chain = key_chain.to_s.split('.')
      config    = self.public_send(key_chain.shift)
      key_chain.each do |key|
        if config.kind_of?(Hash)
          config = config[key] || config[key.to_sym]
        else
          return
        end
      end
      config
    end
  end

end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
txcatcher-0.2.14 lib/txcatcher/config.rb
txcatcher-0.2.12 lib/txcatcher/config.rb
txcatcher-0.2.11 lib/txcatcher/config.rb
txcatcher-0.2.10 lib/txcatcher/config.rb
txcatcher-0.2.9 lib/txcatcher/config.rb
txcatcher-0.2.8 lib/txcatcher/config.rb
txcatcher-0.2.6 lib/txcatcher/config.rb
txcatcher-0.2.4 lib/txcatcher/config.rb
txcatcher-0.2.3 lib/txcatcher/config.rb
txcatcher-0.2.2 lib/txcatcher/config.rb
txcatcher-0.2.1 lib/txcatcher/config.rb
txcatcher-0.2.0 lib/txcatcher/config.rb
txcatcher-0.1.100 lib/txcatcher/config.rb
txcatcher-0.1.99 lib/txcatcher/config.rb
txcatcher-0.1.98 lib/txcatcher/config.rb
txcatcher-0.1.97 lib/txcatcher/config.rb
txcatcher-0.1.96 lib/txcatcher/config.rb
txcatcher-0.1.95 lib/txcatcher/config.rb
txcatcher-0.1.94 lib/txcatcher/config.rb
txcatcher-0.1.93 lib/txcatcher/config.rb