Sha256: 2544c620d4118af514fe9a596c9313461f65a41042bd40c0d1b7d814243d3de8

Contents?: true

Size: 659 Bytes

Versions: 14

Compression:

Stored size: 659 Bytes

Contents

require "license_acceptance/strategy/base"

module LicenseAcceptance
  module Strategy

    # Look for acceptance values in the environment
    class Environment < Base

      attr_reader :env

      def initialize(env)
        @env = env
      end

      def accepted?
        look_for_value(ACCEPT)
      end

      def silent?
        look_for_value(ACCEPT_SILENT)
      end

      def no_persist?
        look_for_value(ACCEPT_NO_PERSIST)
      end

      private

      def look_for_value(sought)
        if env['CHEF_LICENSE'] && env['CHEF_LICENSE'].downcase == sought
          return true
        end
        return false
      end

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
license-acceptance-1.0.18 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.13 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.12 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.11 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.8 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.7 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.6 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.5 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.3 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.2 lib/license_acceptance/strategy/environment.rb
license-acceptance-1.0.0 lib/license_acceptance/strategy/environment.rb
license-acceptance-0.2.16 lib/license_acceptance/strategy/environment.rb
license-acceptance-0.2.15 lib/license_acceptance/strategy/environment.rb
license-acceptance-0.2.13 lib/license_acceptance/strategy/environment.rb