Sha256: 8d6f6f964778502fdd3b93f811d8725b0b4cf031e7f0092f8773d659e09754ab

Contents?: true

Size: 762 Bytes

Versions: 9

Compression:

Stored size: 762 Bytes

Contents

module Picky
  class Index
    
    class Hints
      
      def initialize hints
        @hints = check hints
      end
      
      # Check if all hints are allowed
      #
      @@allowed_hints = [:no_dump]
      def check hints
        hints.each do |hint|
          unless @@allowed_hints.include?(hint)
            raise <<-ERROR
              Picky cannot optimize for #{hint}.
              Allowed hints are:
                #{@@allowed_hints.join("\n")}
            ERROR
          end
        end
        hints
      end
      
      # Tells us if the user intends to e.g. not dump the indexes.
      #
      # E.g. hints.does?(:no_dump) # => true/false
      #
      def does? hint
        @hints.include? hint
      end
      
    end
    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
picky-4.31.3 lib/picky/index/hints.rb
picky-4.31.2 lib/picky/index/hints.rb
picky-4.31.1 lib/picky/index/hints.rb
picky-4.31.0 lib/picky/index/hints.rb
picky-4.30.0 lib/picky/index/hints.rb
picky-4.29.0 lib/picky/index/hints.rb
picky-4.28.1 lib/picky/index/hints.rb
picky-4.27.1 lib/picky/index/hints.rb
picky-4.27.0 lib/picky/index/hints.rb