picky 4.12.1 → 4.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. data/lib/picky/backends/backend.rb +5 -3
  2. data/lib/picky/backends/file/basic.rb +1 -1
  3. data/lib/picky/backends/file/json.rb +1 -1
  4. data/lib/picky/backends/file.rb +5 -4
  5. data/lib/picky/backends/memory.rb +4 -4
  6. data/lib/picky/backends/prepared/text.rb +2 -0
  7. data/lib/picky/backends/redis.rb +1 -1
  8. data/lib/picky/bundle.rb +3 -3
  9. data/lib/picky/categories.rb +24 -14
  10. data/lib/picky/categories_convenience.rb +1 -2
  11. data/lib/picky/categories_indexed.rb +2 -4
  12. data/lib/picky/categories_indexing.rb +4 -4
  13. data/lib/picky/categories_realtime.rb +7 -7
  14. data/lib/picky/character_substituters/west_european.rb +1 -1
  15. data/lib/picky/extensions/class.rb +4 -4
  16. data/lib/picky/extensions/module.rb +29 -7
  17. data/lib/picky/index.rb +26 -25
  18. data/lib/picky/index_convenience.rb +1 -3
  19. data/lib/picky/index_indexed.rb +5 -5
  20. data/lib/picky/index_indexing.rb +2 -6
  21. data/lib/picky/index_realtime.rb +7 -7
  22. data/lib/picky/indexers/base.rb +2 -2
  23. data/lib/picky/indexes.rb +12 -17
  24. data/lib/picky/indexes_convenience.rb +1 -3
  25. data/lib/picky/indexes_indexed.rb +2 -5
  26. data/lib/picky/indexes_indexing.rb +2 -6
  27. data/lib/picky/loader.rb +1 -0
  28. data/lib/picky/query/allocation.rb +1 -1
  29. data/lib/picky/query/allocations.rb +7 -7
  30. data/lib/picky/query/boosts.rb +1 -2
  31. data/lib/picky/query/combinations.rb +3 -3
  32. data/lib/picky/query/indexes.rb +18 -18
  33. data/lib/picky/query/token.rb +1 -1
  34. data/lib/picky/query/tokens.rb +2 -2
  35. data/lib/picky/rack/harakiri.rb +1 -1
  36. data/lib/picky/results.rb +2 -2
  37. data/lib/picky/search.rb +5 -5
  38. data/lib/picky/search_facets.rb +3 -3
  39. data/lib/picky/sinatra.rb +1 -1
  40. data/lib/picky/tokenizer/regexp_wrapper.rb +19 -0
  41. data/lib/picky/tokenizer.rb +2 -13
  42. data/lib/picky/wrappers/bundle/delegators.rb +44 -44
  43. data/lib/picky/wrappers/bundle/wrapper.rb +1 -1
  44. data/lib/picky.rb +0 -2
  45. data/lib/tasks/server.rake +2 -1
  46. data/spec/functional/backends/redis_bundle_realtime_spec.rb +1 -1
  47. data/spec/functional/backends/sqlite_bundle_realtime_spec.rb +1 -1
  48. data/spec/functional/custom_delimiters_spec.rb +0 -2
  49. data/spec/functional/facets_spec.rb +1 -1
  50. data/spec/lib/backends/backend_spec.rb +1 -1
  51. data/spec/lib/backends/file/basic_spec.rb +1 -1
  52. data/spec/lib/backends/file_spec.rb +1 -1
  53. data/spec/lib/backends/memory/json_spec.rb +1 -1
  54. data/spec/lib/backends/memory/marshal_spec.rb +1 -1
  55. data/spec/lib/backends/redis/float_spec.rb +1 -1
  56. data/spec/lib/backends/redis/string_spec.rb +1 -1
  57. data/spec/lib/backends/sqlite/array_spec.rb +2 -2
  58. data/spec/lib/backends/sqlite/value_spec.rb +1 -1
  59. data/spec/lib/category_indexing_spec.rb +1 -1
  60. data/spec/lib/extensions/module_spec.rb +43 -6
  61. data/spec/lib/index_indexed_spec.rb +2 -2
  62. data/spec/lib/index_spec.rb +22 -1
  63. data/spec/lib/indexers/base_spec.rb +1 -1
  64. data/spec/lib/indexes_indexing_spec.rb +2 -2
  65. data/spec/lib/query/allocation_spec.rb +3 -3
  66. data/spec/lib/query/allocations_spec.rb +6 -6
  67. data/spec/lib/query/combinations_spec.rb +1 -1
  68. data/spec/lib/query/tokens_spec.rb +13 -13
  69. data/spec/lib/results_spec.rb +2 -2
  70. data/spec/lib/search_spec.rb +4 -4
  71. data/spec/lib/sinatra_spec.rb +2 -2
  72. metadata +5 -4
@@ -9,6 +9,8 @@ module Picky
9
9
  # This is the default behaviour and should be overridden
10
10
  # for different backends.
11
11
  #
12
+ # TODO Push down.
13
+ #
12
14
 
13
15
  # Returns an object that on #initial, #load returns
14
16
  # an object that responds to:
@@ -21,9 +23,9 @@ module Picky
21
23
  # an object that responds to:
22
24
  # [:token] # => 1.23 (a weight)
23
25
  #
24
- def create_weights bundle
25
- json bundle.index_path(:weights)
26
- end
26
+ # def create_weights bundle
27
+ # json bundle.index_path(:weights)
28
+ # end
27
29
  # # Returns an object that on #initial, #load returns
28
30
  # # an object that responds to:
29
31
  # # [:encoded] # => [:original, :original] (an array of original symbols this similarity encoded thing maps to)
@@ -27,7 +27,7 @@ module Picky
27
27
  # This is the mapping file with the in-memory hash for the
28
28
  # file position/offset mappings.
29
29
  #
30
- @mapping_file = Memory::JSON.new "#{cache_path}.file_mapping.#{extension}"
30
+ @mapping_file = Memory::JSON.new "#{cache_path}.file_mapping"
31
31
 
32
32
  @empty = options[:empty]
33
33
  @initial = options[:initial]
@@ -65,7 +65,7 @@ module Picky
65
65
  def dump hash
66
66
  offset = 0
67
67
  mapping = {}
68
-
68
+
69
69
  create_directory cache_path
70
70
  ::File.open(cache_path, 'w:utf-8') do |out_file|
71
71
  hash.each do |(key, object)|
@@ -9,10 +9,11 @@ module Picky
9
9
  # ...[1,2,3,21,7,4,13,15]...
10
10
  #
11
11
  class File < Backend
12
-
13
- # Returns an object that on #initial, #load returns an object that responds to:
14
- # [:encoded] # => [:original, :original] (an array of original symbols this similarity encoded thing maps to)
15
- #
12
+
13
+ def create_weights bundle
14
+ Memory::JSON.new bundle.index_path(:weights)
15
+ end
16
+
16
17
  def create_similarity bundle
17
18
  json bundle.index_path(:similarity)
18
19
  end
@@ -4,10 +4,10 @@ module Picky
4
4
 
5
5
  class Memory < Backend
6
6
 
7
- # Returns an object that on #initial, #load returns
8
- # an object that responds to:
9
- # [:encoded] # => [:original, :original] (an array of original symbols this similarity encoded thing maps to)
10
- #
7
+ def create_weights bundle
8
+ JSON.new bundle.index_path(:weights)
9
+ end
10
+
11
11
  def create_similarity bundle
12
12
  Marshal.new bundle.index_path(:similarity)
13
13
  end
@@ -49,6 +49,8 @@ module Picky
49
49
  #
50
50
  # Yields an id string and a token.
51
51
  #
52
+ # TODO Think about the comma - what if you have commas in the id?
53
+ #
52
54
  def retrieve
53
55
  id = nil
54
56
  token = nil
@@ -14,7 +14,7 @@ module Picky
14
14
  check_hiredis_gem
15
15
  check_redis_gem
16
16
 
17
- @client = options[:client] || ::Redis.new(:db => (options[:db] || 15))
17
+ @client = options[:client] || ::Redis.new(:db => (options[:db] || 15))
18
18
  @realtime = options[:realtime]
19
19
  end
20
20
  def maybe_load_hiredis
data/lib/picky/bundle.rb CHANGED
@@ -41,8 +41,8 @@ module Picky
41
41
  :partial_strategy,
42
42
  :similarity_strategy
43
43
 
44
- delegate :[], :[]=, :to => :configuration
45
- delegate :index_directory, :to => :category
44
+ forward :[], :[]=, :to => :configuration
45
+ forward :index_directory, :to => :category
46
46
 
47
47
  # TODO Move the strategies into options.
48
48
  #
@@ -142,7 +142,7 @@ module Picky
142
142
  end
143
143
  end
144
144
 
145
- # If a key format is set, use it, else delegate to the category.
145
+ # If a key format is set, use it, else forward to the category.
146
146
  #
147
147
  def key_format
148
148
  @key_format || @category.key_format
@@ -4,18 +4,18 @@ module Picky
4
4
 
5
5
  attr_reader :categories, :category_hash
6
6
 
7
- delegate :each,
8
- :first,
9
- :map,
10
- :to => :categories
7
+ forward :each,
8
+ :first,
9
+ :map,
10
+ :to => :categories
11
11
 
12
- each_delegate :cache,
13
- :dump,
14
- :empty,
15
- :inject,
16
- :reindex,
17
- :reset_backend,
18
- :to => :categories
12
+ each_forward :cache,
13
+ :dump,
14
+ :empty,
15
+ :inject,
16
+ :reindex,
17
+ :reset_backend,
18
+ :to => :categories
19
19
 
20
20
  # A list of indexed categories.
21
21
  #
@@ -37,14 +37,20 @@ module Picky
37
37
  # To add the qualifiers to a search, you call this
38
38
  # method.
39
39
  #
40
- def mapper
41
- @mapper ||= QualifierMapper.new self
40
+ def qualifier_mapper
41
+ @qualifier_mapper ||= QualifierMapper.new self
42
+ end
43
+
44
+ # Resets the qualifier mapper used.
45
+ #
46
+ def reset_qualifier_mapper
47
+ @qualifier_mapper = nil
42
48
  end
43
49
 
44
50
  # Add the given category to the list of categories.
45
51
  #
46
52
  def << category
47
- @mapper = nil # TODO Move. (Resets category mapping)
53
+ reset_qualifier_mapper # TODO Have an add method on QualifierMapper?
48
54
  categories << category
49
55
  category_hash[category.name] = category
50
56
  end
@@ -58,6 +64,10 @@ module Picky
58
64
  def raise_not_found category_name
59
65
  raise %Q{Index category "#{category_name}" not found. Possible categories: "#{categories.map(&:name).join('", "')}".}
60
66
  end
67
+
68
+ def to_stats
69
+ map(&:name).join(', ')
70
+ end
61
71
 
62
72
  def to_s
63
73
  "#{self.class}(#{categories.join(', ')})"
@@ -4,8 +4,7 @@ module Picky
4
4
  #
5
5
  class Categories
6
6
 
7
- each_delegate :each_bundle,
8
- :to => :categories
7
+ each_forward :each_bundle, :to => :categories
9
8
 
10
9
  def each_category &block
11
10
  categories.each &block
@@ -2,9 +2,7 @@ module Picky
2
2
 
3
3
  class Categories
4
4
 
5
- each_delegate :load,
6
- :analyze,
7
- :to => :categories
5
+ each_forward :load, :analyze, :to => :categories
8
6
 
9
7
  # Return all possible combinations for the given token.
10
8
  #
@@ -64,7 +62,7 @@ module Picky
64
62
  # TODO Called too often?
65
63
  #
66
64
  def possible_categories token
67
- token.predefined_categories(mapper) || categories
65
+ token.predefined_categories(qualifier_mapper) || categories
68
66
  end
69
67
 
70
68
  end
@@ -4,10 +4,10 @@ module Picky
4
4
 
5
5
  include Helpers::Indexing
6
6
 
7
- each_delegate :cache,
8
- :clear,
9
- :prepare,
10
- :to => :categories
7
+ each_forward :cache,
8
+ :clear,
9
+ :prepare,
10
+ :to => :categories
11
11
  end
12
12
 
13
13
  end
@@ -2,13 +2,13 @@ module Picky
2
2
 
3
3
  class Categories
4
4
 
5
- each_delegate :remove,
6
- :add,
7
- :replace,
8
- :replace_from,
9
- :clear_realtime,
10
- :build_realtime_mapping,
11
- :to => :categories
5
+ each_forward :remove,
6
+ :add,
7
+ :replace,
8
+ :replace_from,
9
+ :clear_realtime,
10
+ :build_realtime_mapping,
11
+ :to => :categories
12
12
 
13
13
  end
14
14
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  #
3
- # THINK Does it also remove diaritics, like べ to へ?
3
+ # THINK Does it also remove diacritics, like べ to へ?
4
4
  #
5
5
  module Picky
6
6
 
@@ -2,11 +2,11 @@
2
2
  #
3
3
  class Class
4
4
 
5
- def instance_delegate *method_names
5
+ def instance_forward *method_names
6
6
  method_names.each do |method_name|
7
- module_eval(<<-DELEGATION, "(__DELEGATION__)", 1)
8
- def self.#{method_name}(*args, &block)\n self.instance.#{method_name}(*args, &block)\nend
9
- DELEGATION
7
+ module_eval(<<-FORWARDING, "(__INSTANCE_FORWARDING__)", 1)
8
+ def self.#{method_name}(*args, &block)\n self.instance.#{method_name}(*args, &block)\nend\n
9
+ FORWARDING
10
10
  end
11
11
  end
12
12
 
@@ -1,15 +1,37 @@
1
1
  # The original Module class.
2
2
  #
3
3
  class Module
4
-
5
- def each_delegate *methods
6
- options = methods.pop
7
- unless options.is_a?(Hash) && to = options[:to]
8
- raise ArgumentError, "Multi delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :something, :to => :an_array_reader)."
4
+
5
+ def forward *methods
6
+ to = extract_to_from_options methods,
7
+ "Forwarding needs a target. Supply an options hash with a :to key as the last argument (e.g. forward :something, :to => :an_array_reader)."
8
+ forwarding methods do |method|
9
+ "def #{method}(*args, &block)\n#{to}.__send__(#{method.inspect}, *args, &block)\nend\n"
9
10
  end
10
- methods.each do |method|
11
- module_eval("def #{method}(*args, &block)\n#{to}.each{ |t| t.__send__(#{method.inspect}, *args, &block) }\nend\n", "(__DELEGATION__)", 1)
11
+ end
12
+
13
+ def each_forward *methods
14
+ to = extract_to_from_options methods,
15
+ "Multi forwarding needs a target. Supply an options hash with a :to key as the last argument (e.g. each_forward :something, :to => :an_array_reader)."
16
+ forwarding methods do |method|
17
+ "def #{method}(*args, &block)\n#{to}.each{ |t| t.__send__(#{method.inspect}, *args, &block) }\nend\n"
12
18
  end
13
19
  end
20
+
21
+ private
22
+
23
+ def extract_to_from_options args, error_string
24
+ options = args.pop
25
+ unless options.is_a?(Hash) && to = options[:to]
26
+ raise ArgumentError, "Multi forwarding needs a target. Supply an options hash with a :to key as the last argument (e.g. each_forward :something, :to => :an_array_reader)."
27
+ end
28
+ to
29
+ end
30
+
31
+ def forwarding methods, &method_definition
32
+ methods.each do |method|
33
+ module_eval method_definition[method], "(__FORWARDING__)", 1
34
+ end
35
+ end
14
36
 
15
37
  end
data/lib/picky/index.rb CHANGED
@@ -89,12 +89,12 @@ module Picky
89
89
  attr_reader :name,
90
90
  :categories
91
91
 
92
- delegate :[],
93
- :dump,
94
- :each,
95
- :inject,
96
- :reset_backend,
97
- :to => :categories
92
+ forward :[],
93
+ :dump,
94
+ :each,
95
+ :inject,
96
+ :reset_backend,
97
+ :to => :categories
98
98
 
99
99
  # Create a new index with a given source.
100
100
  #
@@ -140,23 +140,23 @@ module Picky
140
140
  @backend ||= Backends::Memory.new
141
141
  end
142
142
  end
143
-
144
- # Ignore the categories with these qualifiers.
145
- #
146
- # Example:
147
- # search = Search.new(index1, index2, index3) do
148
- # ignore :name, :first_name
149
- # end
150
- #
151
- # Cleans up / optimizes after being called.
152
- #
153
- # TODO This needs to move to the index.
143
+
144
+ # TODO Reinstate.
154
145
  #
155
- def ignore *qualifiers
156
- @ignored_categories ||= []
157
- @ignored_categories += qualifiers.map { |qualifier| @mapper.map qualifier }.compact
158
- @ignored_categories.uniq!
159
- end
146
+ # # Ignore the categories with these qualifiers.
147
+ # #
148
+ # # Example:
149
+ # # search = Search.new(index1, index2, index3) do
150
+ # # ignore :name, :first_name
151
+ # # end
152
+ # #
153
+ # # Cleans up / optimizes after being called.
154
+ # #
155
+ # def ignore *qualifiers
156
+ # @ignored_categories ||= []
157
+ # @ignored_categories += qualifiers.map { |qualifier| @qualifier_mapper.map qualifier }.compact
158
+ # @ignored_categories.uniq!
159
+ # end
160
160
 
161
161
  # SYMBOLS.
162
162
  #
@@ -209,7 +209,7 @@ module Picky
209
209
  #
210
210
  def only *qualifiers
211
211
  raise "Sorry, Picky::Search#only has been removed in version."
212
- # @mapper.restrict_to *qualifiers
212
+ # @qualifier_mapper.restrict_to *qualifiers
213
213
  end
214
214
 
215
215
  # The directory used by this index.
@@ -362,9 +362,10 @@ module Picky
362
362
  stats = <<-INDEX
363
363
  #{name} (#{self.class}):
364
364
  #{"source: #{source}".indented_to_s}
365
- #{"categories: #{categories.map(&:name).join(', ')}".indented_to_s}
365
+ #{"categories: #{categories.to_stats}".indented_to_s}
366
366
  INDEX
367
- stats << " result identifier: \"#{result_identifier}\"".indented_to_s unless result_identifier.to_s == name.to_s
367
+ stats << "result identifier: \"#{result_identifier}\"".indented_to_s unless result_identifier.to_s == name.to_s
368
+ stats << "\n"
368
369
  stats
369
370
  end
370
371
 
@@ -4,9 +4,7 @@ module Picky
4
4
  #
5
5
  class Index
6
6
 
7
- delegate :each_bundle,
8
- :each_category,
9
- :to => :categories
7
+ forward :each_bundle, :each_category, :to => :categories
10
8
 
11
9
  end
12
10
 
@@ -4,11 +4,11 @@ module Picky
4
4
  #
5
5
  class Index
6
6
 
7
- delegate :load,
8
- :analyze,
9
- :reindex,
10
- :possible_combinations,
11
- :to => :categories
7
+ forward :load,
8
+ :analyze,
9
+ :reindex,
10
+ :possible_combinations,
11
+ :to => :categories
12
12
 
13
13
  # Define how the results of this index are identified.
14
14
  # (Shown in the client, for example)
@@ -5,11 +5,7 @@ module Picky
5
5
  class Index
6
6
  include Helpers::Indexing
7
7
 
8
- # Delegators for indexing.
9
- #
10
- delegate :cache,
11
- :clear,
12
- :to => :categories
8
+ forward :cache, :clear, :to => :categories
13
9
 
14
10
  # Define an index tokenizer on the index.
15
11
  #
@@ -23,7 +19,7 @@ module Picky
23
19
  # on every category.
24
20
  #
25
21
  # Decides whether to use a parallel indexer or whether to
26
- # delegate to each category to prepare themselves.
22
+ # forward to each category to prepare themselves.
27
23
  #
28
24
  def prepare scheduler = Scheduler.new
29
25
  if source.respond_to?(:each)
@@ -4,13 +4,13 @@ module Picky
4
4
  #
5
5
  class Index
6
6
 
7
- delegate :remove, # aka "delete".
8
- :add, # aka "insert".
9
- :replace, # aka "insert or update". Thus, not called update.
10
- :replace_from,
11
- :clear_realtime,
12
- :build_realtime_mapping,
13
- :to => :categories
7
+ forward :remove, # aka "delete".
8
+ :add, # aka "insert".
9
+ :replace, # aka "insert or update". Thus, not called update.
10
+ :replace_from,
11
+ :clear_realtime,
12
+ :build_realtime_mapping,
13
+ :to => :categories
14
14
 
15
15
  # Add at the end.
16
16
  #
@@ -10,8 +10,8 @@ module Picky
10
10
 
11
11
  attr_reader :index_or_category
12
12
 
13
- delegate :source,
14
- :to => :index_or_category
13
+ forward :source,
14
+ :to => :index_or_category
15
15
 
16
16
  def initialize index_or_category
17
17
  @index_or_category = index_or_category
data/lib/picky/indexes.rb CHANGED
@@ -3,7 +3,7 @@ module Picky
3
3
  # Holds all indexes and provides operations
4
4
  # for extracting and working on them.
5
5
  #
6
- # Delegates a number of operations to the
6
+ # Forwards a number of operations to the
7
7
  # indexes.
8
8
  #
9
9
  class Indexes
@@ -11,12 +11,17 @@ module Picky
11
11
  attr_reader :indexes,
12
12
  :index_mapping
13
13
 
14
- delegate :size,
15
- :each,
16
- :to => :indexes
17
-
18
- each_delegate :reindex,
19
- :to => :indexes
14
+ forward :size, :each, :to => :indexes
15
+ each_forward :reindex, :to => :indexes
16
+ instance_forward :clear,
17
+ :clear_indexes,
18
+ :register,
19
+ :reindex,
20
+ :[],
21
+ :to_s,
22
+ :size,
23
+ :each,
24
+ :each_category
20
25
 
21
26
  def initialize *indexes
22
27
  clear_indexes
@@ -32,16 +37,6 @@ module Picky
32
37
  name
33
38
  end
34
39
 
35
- instance_delegate :clear,
36
- :clear_indexes,
37
- :register,
38
- :reindex,
39
- :[],
40
- :to_s,
41
- :size,
42
- :each,
43
- :each_category
44
-
45
40
  # Clears the indexes and the mapping.
46
41
  #
47
42
  def clear_indexes
@@ -2,9 +2,7 @@ module Picky
2
2
 
3
3
  class Indexes
4
4
 
5
- each_delegate :each_bundle,
6
- :each_category,
7
- :to => :indexes
5
+ each_forward :each_bundle, :each_category, :to => :indexes
8
6
 
9
7
  end
10
8
 
@@ -4,11 +4,8 @@ module Picky
4
4
  #
5
5
  class Indexes
6
6
 
7
- instance_delegate :load,
8
- :analyze
9
-
10
- each_delegate :load,
11
- :to => :indexes
7
+ instance_forward :load, :analyze
8
+ each_forward :load, :to => :indexes
12
9
 
13
10
  end
14
11
 
@@ -7,13 +7,9 @@ module Picky
7
7
  extend Helpers::Indexing
8
8
  include Helpers::Indexing
9
9
 
10
- instance_delegate :clear,
11
- :tokenizer
10
+ instance_forward :clear, :tokenizer
12
11
 
13
- each_delegate :cache,
14
- :clear,
15
- :prepare,
16
- :to => :indexes
12
+ each_forward :cache, :clear, :prepare, :to => :indexes
17
13
 
18
14
  # Overrides index from the helper.
19
15
  #
data/lib/picky/loader.rb CHANGED
@@ -265,6 +265,7 @@ module Picky
265
265
  load_api
266
266
  load_logging
267
267
  load_relative 'source'
268
+ load_relative 'tokenizer/regexp_wrapper'
268
269
  load_relative 'tokenizer'
269
270
  # load_relative 'rack/harakiri' # Needs to be explicitly loaded/required.
270
271
  load_relative 'character_substituters/west_european'
@@ -108,7 +108,7 @@ module Picky
108
108
 
109
109
  # Json representation of this allocation.
110
110
  #
111
- # Note: Delegates to to_result.
111
+ # Note: Forwards to to_result.
112
112
  #
113
113
  def to_json options = {}
114
114
  MultiJson.encode to_result, options
@@ -14,13 +14,13 @@ module Picky
14
14
  #
15
15
  class Allocations
16
16
 
17
- delegate :each,
18
- :empty?,
19
- :first,
20
- :inject,
21
- :size,
22
- :map,
23
- :to => :@allocations
17
+ forward :each,
18
+ :empty?,
19
+ :first,
20
+ :inject,
21
+ :size,
22
+ :map,
23
+ :to => :@allocations
24
24
 
25
25
  def initialize allocations = []
26
26
  @allocations = allocations
@@ -25,8 +25,7 @@ module Picky
25
25
 
26
26
  attr_reader :boosts
27
27
 
28
- delegate :empty?,
29
- :to => :boosts
28
+ forward :empty?, :to => :boosts
30
29
 
31
30
  # Needs a Hash of
32
31
  # [:category_name1, :category_name2] => +3
@@ -14,9 +14,9 @@ module Picky
14
14
 
15
15
  attr_reader :combinations
16
16
 
17
- delegate :empty?,
18
- :inject,
19
- :to => :@combinations
17
+ forward :empty?,
18
+ :inject,
19
+ :to => :@combinations
20
20
 
21
21
  def initialize combinations = []
22
22
  @combinations = combinations