lib/picky/query/weights.rb in picky-1.2.4 vs lib/picky/query/weights.rb in picky-1.3.0
- old
+ new
@@ -5,11 +5,11 @@
class Weights # :nodoc:all
#
#
def initialize weights = {}
- @weights_cache = {}
+ # @weights_cache = {} # TODO
@weights = prepare weights
end
# Get the category indexes for the given bonuses.
#
@@ -43,9 +43,21 @@
# weight_for combinations.map(&:category).clustered_uniq_fast.map!(&:name)
# TODO combinations could cluster uniq as combinations are added (since combinations don't change).
#
weight_for combinations.map(&:category_name).clustered_uniq_fast
+ end
+
+ # Are there any weights defined?
+ #
+ def empty?
+ @weights.empty?
+ end
+
+ # Prints out a nice representation of the configured weights.
+ #
+ def to_s
+ @weights.to_s
end
end
end
\ No newline at end of file