Sha256: cac44d5c7ac09e1c84c9fc534e0bbedd4dd421bf86cbca99e1b1ddd1fe3f3e7d

Contents?: true

Size: 970 Bytes

Versions: 42

Compression:

Stored size: 970 Bytes

Contents

require 'stringify-hash'

module Beaker
  module Options

    # A hash that treats Symbol and String keys interchangeably
    # and recursively merges hashes
    class OptionsHash < StringifyHash

      # Determine if type of ObjectHash is pe, defaults to true
      #
      # @example Use this method to test if the :type setting is pe
      #     a['type'] = 'pe'
      #     a.is_pe? == true
      #
      # @return [Boolean]
      def is_pe?
        self[:type] ? self[:type] =~ /pe/ : true
      end

      # Determine the puppet type of the ObjectHash
      #
      # Default is FOSS
      #
      # @example Use this method to test if the :type setting is pe
      #     a['type'] = 'pe'
      #     a.get_type == :pe
      #
      # @return [Symbol] the type given in the options
      def get_type
        case self[:type]
        when /pe/
          :pe
        when /foss/
          :foss
        else
          :foss
        end
      end

    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
beaker-2.52.0 lib/beaker/options/options_hash.rb
beaker-3.1.0 lib/beaker/options/options_hash.rb
beaker-3.0.0 lib/beaker/options/options_hash.rb
beaker-2.51.0 lib/beaker/options/options_hash.rb
beaker-2.50.0 lib/beaker/options/options_hash.rb
beaker-2.49.0 lib/beaker/options/options_hash.rb
beaker-2.48.1 lib/beaker/options/options_hash.rb
beaker-2.48.0 lib/beaker/options/options_hash.rb
beaker-2.47.1 lib/beaker/options/options_hash.rb
beaker-2.47.0 lib/beaker/options/options_hash.rb
beaker-2.46.0 lib/beaker/options/options_hash.rb
beaker-2.45.0 lib/beaker/options/options_hash.rb
beaker-2.44.0 lib/beaker/options/options_hash.rb
beaker-2.43.0 lib/beaker/options/options_hash.rb
beaker-2.42.0 lib/beaker/options/options_hash.rb
beaker-2.41.0 lib/beaker/options/options_hash.rb
beaker-2.40.0 lib/beaker/options/options_hash.rb
beaker-2.39.0 lib/beaker/options/options_hash.rb
beaker-2.38.1 lib/beaker/options/options_hash.rb
beaker-2.38.0 lib/beaker/options/options_hash.rb