Sha256: a9d5f2b47b3879eb828675fcb13fc4df28bc826a0e600a565270318d7a1b9ea8

Contents?: true

Size: 400 Bytes

Versions: 4

Compression:

Stored size: 400 Bytes

Contents

module Picky

  class Index
    
    # Return facets for a category in the form:
    #   { text => weight } # or ids.size?
    #
    def facets category_identifier, options = {}
      weights = self[category_identifier].exact.weights
      if minimal_weight = options[:more_than]
        weights.select { |_, weight| weight > minimal_weight }
      else
        weights
      end
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
picky-4.5.11 lib/picky/index_facets.rb
picky-4.5.10 lib/picky/index_facets.rb
picky-4.5.9 lib/picky/index_facets.rb
picky-4.5.8 lib/picky/index_facets.rb