Sha256: 42d5d43af5df5a1b5bbf29d8d15ccbd98d18090b196949463e803a95a5758a4b

Contents?: true

Size: 788 Bytes

Versions: 39

Compression:

Stored size: 788 Bytes

Contents

require 'unleash/bootstrap/provider/from_url'
require 'unleash/bootstrap/provider/from_file'

module Unleash
  module Bootstrap
    class Handler
      attr_accessor :configuration

      def initialize(configuration)
        self.configuration = configuration
      end

      # @return [String] JSON string representing data returned from an Unleash server
      def retrieve_toggles
        return configuration.data unless self.configuration.data.nil?
        return configuration.block.call if self.configuration.block.is_a?(Proc)
        return Provider::FromFile.read(configuration.file_path) unless self.configuration.file_path.nil?
        return Provider::FromUrl.read(configuration.url, configuration.url_headers) unless self.configuration.url.nil?
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
unleash-6.2.0.pre.alpha.0 lib/unleash/bootstrap/handler.rb
unleash-6.1.2 lib/unleash/bootstrap/handler.rb
unleash-6.1.1 lib/unleash/bootstrap/handler.rb
unleash-6.1.0 lib/unleash/bootstrap/handler.rb
unleash-6.0.10 lib/unleash/bootstrap/handler.rb
unleash-6.0.9 lib/unleash/bootstrap/handler.rb
unleash-6.0.8 lib/unleash/bootstrap/handler.rb
unleash-6.0.8.beta.1 lib/unleash/bootstrap/handler.rb
unleash-6.0.7 lib/unleash/bootstrap/handler.rb
unleash-6.0.6 lib/unleash/bootstrap/handler.rb
unleash-6.0.5 lib/unleash/bootstrap/handler.rb
unleash-6.0.0 lib/unleash/bootstrap/handler.rb
unleash-6.0.5.pre lib/unleash/bootstrap/handler.rb
unleash-6.0.4.pre lib/unleash/bootstrap/handler.rb
unleash-6.0.3.pre lib/unleash/bootstrap/handler.rb
unleash-6.0.2.pre lib/unleash/bootstrap/handler.rb
unleash-6.0.1.pre lib/unleash/bootstrap/handler.rb
unleash-6.0.0.pre lib/unleash/bootstrap/handler.rb
unleash-5.1.1 lib/unleash/bootstrap/handler.rb
unleash-5.1.0 lib/unleash/bootstrap/handler.rb