Sha256: d13bd1832c634a4c7195a3ff79895884029c79fbc62628246728d4d9e6922e9c

Contents?: true

Size: 811 Bytes

Versions: 34

Compression:

Stored size: 811 Bytes

Contents

module Unleash
  module Bootstrap
    class Configuration
      attr_accessor :data, :file_path, :url, :url_headers, :block

      def initialize(opts = {})
        self.file_path = resolve_value_indifferently(opts, 'file_path') || ENV['UNLEASH_BOOTSTRAP_FILE'] || nil
        self.url = resolve_value_indifferently(opts, 'url') || ENV['UNLEASH_BOOTSTRAP_URL'] || nil
        self.url_headers = resolve_value_indifferently(opts, 'url_headers')
        self.data = resolve_value_indifferently(opts, 'data')
        self.block = resolve_value_indifferently(opts, 'block')
      end

      def valid?
        ![self.data, self.file_path, self.url, self.block].all?(&:nil?)
      end

      private

      def resolve_value_indifferently(opts, key)
        opts[key] || opts[key.to_sym]
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
unleash-6.0.9 lib/unleash/bootstrap/configuration.rb
unleash-6.0.8 lib/unleash/bootstrap/configuration.rb
unleash-6.0.8.beta.1 lib/unleash/bootstrap/configuration.rb
unleash-6.0.7 lib/unleash/bootstrap/configuration.rb
unleash-6.0.6 lib/unleash/bootstrap/configuration.rb
unleash-6.0.5 lib/unleash/bootstrap/configuration.rb
unleash-6.0.0 lib/unleash/bootstrap/configuration.rb
unleash-6.0.5.pre lib/unleash/bootstrap/configuration.rb
unleash-6.0.4.pre lib/unleash/bootstrap/configuration.rb
unleash-6.0.3.pre lib/unleash/bootstrap/configuration.rb
unleash-6.0.2.pre lib/unleash/bootstrap/configuration.rb
unleash-6.0.1.pre lib/unleash/bootstrap/configuration.rb
unleash-6.0.0.pre lib/unleash/bootstrap/configuration.rb
unleash-5.1.1 lib/unleash/bootstrap/configuration.rb
unleash-5.1.0 lib/unleash/bootstrap/configuration.rb
unleash-5.0.7 lib/unleash/bootstrap/configuration.rb
unleash-5.0.6 lib/unleash/bootstrap/configuration.rb
unleash-5.0.5 lib/unleash/bootstrap/configuration.rb
unleash-5.0.4 lib/unleash/bootstrap/configuration.rb
unleash-5.0.3 lib/unleash/bootstrap/configuration.rb