Sha256: f130d5dc7cfadb9b74f6ee02d84dc215c3f643bcaf29bb6a2aac89e41d9e1c9e

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 Bytes

Contents

require 'r10k/deployment/config'

module R10K
  class Deployment
    class MockConfig
      def initialize(hash)
        @hash = hash
      end

      def configfile
        "/some/nonexistent/config_file"
      end

      # Perform a scan for key and check for both string and symbol keys
      def setting(key)
        keys = [key]
        case key
        when String
          keys << key.to_sym
        when Symbol
          keys << key.to_s
        end

        # Scan all possible keys to see if the config has a matching value
        keys.inject(nil) do |rv, k|
          v = @hash[k]
          break v unless v.nil?
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
r10k-2.0.3 spec/r10k-mocks/mock_config.rb
r10k-2.0.2 spec/r10k-mocks/mock_config.rb
r10k-2.0.1 spec/r10k-mocks/mock_config.rb
r10k-2.0.0 spec/r10k-mocks/mock_config.rb
r10k-1.5.1 spec/r10k-mocks/mock_config.rb
r10k-1.4.2 spec/r10k-mocks/mock_config.rb