lib/picky/bundle.rb in picky-4.21.0 vs lib/picky/bundle.rb in picky-4.21.1
- old
+ new
@@ -41,11 +41,11 @@
:partial_strategy,
:similarity_strategy
forward :[], :[]=, :to => :configuration
forward :index_directory, :to => :category
-
+
# TODO Move the strategies into options.
#
def initialize name, category, weight_strategy, partial_strategy, similarity_strategy, options = {}
@name = name
@category = category
@@ -101,11 +101,11 @@
# internal backend instance.
#
def empty
on_all_indexes_call :empty
end
-
+
# Extracted to avoid duplicate code.
#
def on_all_indexes_call method_name
@inverted = @backend_inverted.send method_name
@weights = @weight_strategy.respond_to?(:saved?) && !@weight_strategy.saved? ? @weight_strategy : @backend_weights.send(method_name)
@@ -161,10 +161,10 @@
# if none given.
#
def index_path type = nil
::File.join index_directory, "#{category.name}_#{name}#{ "_#{type}" if type }"
end
-
+
def to_tree_s indent = 0, &block
s = <<-TREE
#{' ' * indent}#{self.class.name.gsub('Picky::','')}(#{name})
#{' ' * indent} Inverted(#{inverted.size})[#{backend_inverted}]#{block && block.call(inverted)}
#{' ' * indent} Weights (#{weights.size})[#{backend_weights}]#{block && block.call(weights)}
\ No newline at end of file