Sha256: e09ea140349fbfb399feef1b2f91d01217b05d954e2bb0a6753c4709b3799384

Contents?: true

Size: 569 Bytes

Versions: 28

Compression:

Stored size: 569 Bytes

Contents

module Picky
  module API
    module Category

      module Weight

        def extract_weight thing
          return Generators::Weights::Default unless thing

          if thing.respond_to? :weight_for
            thing
          else
            raise <<-ERROR
weight options for #{index_name}:#{name} should be either
* for example a Weights::Logarithmic.new, Weights::Constant.new(int = 0), Weights::Dynamic.new(&block) etc.
or
* an object that responds to #weight_for(amount_of_ids_for_token) => float
ERROR
          end
        end

      end

    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
picky-4.5.6 lib/picky/api/category/weight.rb
picky-4.5.5 lib/picky/api/category/weight.rb
picky-4.5.4 lib/picky/api/category/weight.rb
picky-4.5.3 lib/picky/api/category/weight.rb
picky-4.5.2 lib/picky/api/category/weight.rb
picky-4.5.1 lib/picky/api/category/weight.rb
picky-4.5.0 lib/picky/api/category/weight.rb
picky-4.4.2 lib/picky/api/category/weight.rb
picky-4.4.1 lib/picky/api/category/weight.rb
picky-4.4.0 lib/picky/api/category/weight.rb
picky-4.3.2 lib/picky/api/category/weight.rb
picky-4.3.1 lib/picky/api/category/weight.rb
picky-4.3.0 lib/picky/api/category/weight.rb
picky-4.2.4 lib/picky/api/category/weight.rb
picky-4.2.3 lib/picky/api/category/weight.rb
picky-4.2.2 lib/picky/api/category/weight.rb
picky-4.2.1 lib/picky/api/category/weight.rb
picky-4.2.0 lib/picky/api/category/weight.rb
picky-4.1.0 lib/picky/api/category/weight.rb
picky-4.0.9 lib/picky/api/category/weight.rb