picky 3.4.0 → 3.4.1
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.
- data/lib/picky/backends/memory/json.rb +1 -1
 - data/lib/picky/backends/redis.rb +81 -23
 - data/lib/picky/extensions/string.rb +45 -0
 - data/lib/picky/extensions/symbol.rb +5 -2
 - data/lib/picky/generators/partial/substring.rb +4 -2
 - data/lib/picky/loader.rb +1 -0
 - data/lib/picky/query/token.rb +1 -1
 - data/spec/lib/backends/redis_spec.rb +26 -0
 - data/spec/lib/extensions/string_spec.rb +492 -0
 - data/spec/lib/extensions/symbol_spec.rb +20 -4
 - data/spec/specific/regression_spec.rb +35 -0
 - metadata +32 -27
 
| 
         @@ -17,7 +17,7 @@ module Picky 
     | 
|
| 
       17 
17 
     | 
    
         
             
                    # Loads the index hash from json format.
         
     | 
| 
       18 
18 
     | 
    
         
             
                    #
         
     | 
| 
       19 
19 
     | 
    
         
             
                    def load
         
     | 
| 
       20 
     | 
    
         
            -
                      Yajl::Parser.parse ::File.open(cache_path, 'r'), symbolize_keys: true
         
     | 
| 
      
 20 
     | 
    
         
            +
                      Yajl::Parser.parse ::File.open(cache_path, 'r'), symbolize_keys: true # TODO to_sym
         
     | 
| 
       21 
21 
     | 
    
         
             
                    end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
                    # Dumps the index hash in json format.
         
     | 
    
        data/lib/picky/backends/redis.rb
    CHANGED
    
    | 
         @@ -46,6 +46,40 @@ module Picky 
     | 
|
| 
       46 
46 
     | 
    
         
             
                    String.new(client, "#{bundle.identifier}:configuration")
         
     | 
| 
       47 
47 
     | 
    
         
             
                  end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
      
 49 
     | 
    
         
            +
                  # Does the Redis version already include
         
     | 
| 
      
 50 
     | 
    
         
            +
                  # scripting support?
         
     | 
| 
      
 51 
     | 
    
         
            +
                  #
         
     | 
| 
      
 52 
     | 
    
         
            +
                  def redis_with_scripting?
         
     | 
| 
      
 53 
     | 
    
         
            +
                    at_least_version redis_version, [2, 6, 0]
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  # Compares two versions each in an array [major, minor, patch]
         
     | 
| 
      
 57 
     | 
    
         
            +
                  # format and returns true if the first version is higher
         
     | 
| 
      
 58 
     | 
    
         
            +
                  # or the same as the second one. False if not.
         
     | 
| 
      
 59 
     | 
    
         
            +
                  #
         
     | 
| 
      
 60 
     | 
    
         
            +
                  # Note: Destructive.
         
     | 
| 
      
 61 
     | 
    
         
            +
                  #
         
     | 
| 
      
 62 
     | 
    
         
            +
                  def at_least_version major_minor_patch, should_be
         
     | 
| 
      
 63 
     | 
    
         
            +
                    3.times { return false if major_minor_patch.shift < should_be.shift }
         
     | 
| 
      
 64 
     | 
    
         
            +
                    true
         
     | 
| 
      
 65 
     | 
    
         
            +
                  end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                  # Returns an array describing the
         
     | 
| 
      
 68 
     | 
    
         
            +
                  # current Redis version.
         
     | 
| 
      
 69 
     | 
    
         
            +
                  #
         
     | 
| 
      
 70 
     | 
    
         
            +
                  # Note: This method assumes that clients answer
         
     | 
| 
      
 71 
     | 
    
         
            +
                  #       to #info with a hash (string/symbol keys)
         
     | 
| 
      
 72 
     | 
    
         
            +
                  #       detailing the infos.
         
     | 
| 
      
 73 
     | 
    
         
            +
                  #
         
     | 
| 
      
 74 
     | 
    
         
            +
                  # Example:
         
     | 
| 
      
 75 
     | 
    
         
            +
                  #   backend.redis_version # => [2, 4, 1]
         
     | 
| 
      
 76 
     | 
    
         
            +
                  #
         
     | 
| 
      
 77 
     | 
    
         
            +
                  def redis_version
         
     | 
| 
      
 78 
     | 
    
         
            +
                    infos          = client.info
         
     | 
| 
      
 79 
     | 
    
         
            +
                    version_string = infos['redis_version'] || infos[:redis_version]
         
     | 
| 
      
 80 
     | 
    
         
            +
                    version_string.split('.').map &:to_i
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
       49 
83 
     | 
    
         
             
                  # Returns the result ids for the allocation.
         
     | 
| 
       50 
84 
     | 
    
         
             
                  #
         
     | 
| 
       51 
85 
     | 
    
         
             
                  # Developers wanting to program fast intersection
         
     | 
| 
         @@ -54,29 +88,53 @@ module Picky 
     | 
|
| 
       54 
88 
     | 
    
         
             
                  #
         
     | 
| 
       55 
89 
     | 
    
         
             
                  # Note: We use the amount and offset hints to speed Redis up.
         
     | 
| 
       56 
90 
     | 
    
         
             
                  #
         
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
      
 91 
     | 
    
         
            +
            #       def ids combinations, amount, offset
         
     | 
| 
      
 92 
     | 
    
         
            +
            #         if redis_with_scripting?
         
     | 
| 
      
 93 
     | 
    
         
            +
            #           @@script = <<-SCRIPT
         
     | 
| 
      
 94 
     | 
    
         
            +
            # redis.call('zinterstore', KEYS[1], ARGV[1]);
         
     | 
| 
      
 95 
     | 
    
         
            +
            # local result = redis.call('zrange', KEYS[1], ARGV[2], ARGV[3])
         
     | 
| 
      
 96 
     | 
    
         
            +
            # redis.call('del', KEYS[1])
         
     | 
| 
      
 97 
     | 
    
         
            +
            # return result
         
     | 
| 
      
 98 
     | 
    
         
            +
            # SCRIPT
         
     | 
| 
      
 99 
     | 
    
         
            +
            #           # Scripting version of #ids.
         
     | 
| 
      
 100 
     | 
    
         
            +
            #           #
         
     | 
| 
      
 101 
     | 
    
         
            +
            #           def ids combinations, amount, offset
         
     | 
| 
      
 102 
     | 
    
         
            +
            #             identifiers = combinations.inject([]) do |identifiers, combination|
         
     | 
| 
      
 103 
     | 
    
         
            +
            #               identifiers << "#{combination.identifier}"
         
     | 
| 
      
 104 
     | 
    
         
            +
            #             end
         
     | 
| 
      
 105 
     | 
    
         
            +
            #
         
     | 
| 
      
 106 
     | 
    
         
            +
            #             # Assume it's using EVALSHA.
         
     | 
| 
      
 107 
     | 
    
         
            +
            #             #
         
     | 
| 
      
 108 
     | 
    
         
            +
            #             client.eval @@script, generate_intermediate_result_id, identifiers, offset, (offset + amount)
         
     | 
| 
      
 109 
     | 
    
         
            +
            #           end
         
     | 
| 
      
 110 
     | 
    
         
            +
            #         else
         
     | 
| 
      
 111 
     | 
    
         
            +
                      # Non-Scripting version of #ids.
         
     | 
| 
      
 112 
     | 
    
         
            +
                      #
         
     | 
| 
      
 113 
     | 
    
         
            +
                      def ids combinations, amount, offset
         
     | 
| 
      
 114 
     | 
    
         
            +
                        identifiers = combinations.inject([]) do |identifiers, combination|
         
     | 
| 
      
 115 
     | 
    
         
            +
                          identifiers << "#{combination.identifier}"
         
     | 
| 
      
 116 
     | 
    
         
            +
                        end
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                        result_id = generate_intermediate_result_id
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
                        # Intersect and store.
         
     | 
| 
      
 121 
     | 
    
         
            +
                        #
         
     | 
| 
      
 122 
     | 
    
         
            +
                        client.zinterstore result_id, identifiers
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                        # Get the stored result.
         
     | 
| 
      
 125 
     | 
    
         
            +
                        #
         
     | 
| 
      
 126 
     | 
    
         
            +
                        results = client.zrange result_id, offset, (offset + amount)
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                        # Delete the stored result as it was only for temporary purposes.
         
     | 
| 
      
 129 
     | 
    
         
            +
                        #
         
     | 
| 
      
 130 
     | 
    
         
            +
                        # Note: I could also not delete it, but that would not be clean at all.
         
     | 
| 
      
 131 
     | 
    
         
            +
                        #
         
     | 
| 
      
 132 
     | 
    
         
            +
                        client.del result_id
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
                        results
         
     | 
| 
      
 135 
     | 
    
         
            +
                      end
         
     | 
| 
      
 136 
     | 
    
         
            +
                    # end
         
     | 
| 
      
 137 
     | 
    
         
            +
                  # end
         
     | 
| 
       80 
138 
     | 
    
         | 
| 
       81 
139 
     | 
    
         
             
                  # Generate a multiple host/process safe result id.
         
     | 
| 
       82 
140 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Extending the String class.
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            class String # :nodoc:all
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              # 'keys'.each_subtoken    # => yields each of ['keys', 'key', 'ke', 'k']
         
     | 
| 
      
 6 
     | 
    
         
            +
              # 'keys'.each_subtoken(2) # => yields each of ['keys', 'key', 'ke']
         
     | 
| 
      
 7 
     | 
    
         
            +
              #
         
     | 
| 
      
 8 
     | 
    
         
            +
              def each_subtoken from_length = 1, range = nil
         
     | 
| 
      
 9 
     | 
    
         
            +
                sub = self
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                sub = sub[range] if range
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                yield sub
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                size = sub.size
         
     | 
| 
      
 16 
     | 
    
         
            +
                from_length = size + from_length + 1 if from_length < 0
         
     | 
| 
      
 17 
     | 
    
         
            +
                from_length = size if size < from_length
         
     | 
| 
      
 18 
     | 
    
         
            +
                from_length = 1 if from_length < 1
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                size.downto(from_length + 1) { yield sub = sub.chop }
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              # 'keys'.each_intoken         # => yields each of ['keys', 'key', 'eys', 'ke', 'ey', 'ys', 'k', 'e', 'y', 's']
         
     | 
| 
      
 24 
     | 
    
         
            +
              # 'keys'.each_intoken(2)      # => yields each of ['keys', 'key', 'eys', 'ke', 'ey', 'ys']
         
     | 
| 
      
 25 
     | 
    
         
            +
              # 'keys'.each_intoken(2, 3)   # => yields each of ['key', 'eys', 'ke', 'ey', 'ys']
         
     | 
| 
      
 26 
     | 
    
         
            +
              # 'keys'.each_intoken(10, 12) # => yields nothing (min larger than str)
         
     | 
| 
      
 27 
     | 
    
         
            +
              #
         
     | 
| 
      
 28 
     | 
    
         
            +
              def each_intoken min_length = 1, max_length = -1
         
     | 
| 
      
 29 
     | 
    
         
            +
                max_length = size + max_length + 1 if max_length < 0
         
     | 
| 
      
 30 
     | 
    
         
            +
                max_length = size if size < max_length
         
     | 
| 
      
 31 
     | 
    
         
            +
                max_length = 1 if max_length < 1
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                min_length = size + min_length + 1 if min_length < 0
         
     | 
| 
      
 34 
     | 
    
         
            +
                min_length = 1 if min_length < 1
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                this_many = size - max_length + 1
         
     | 
| 
      
 37 
     | 
    
         
            +
                max_length.downto(min_length) do |length|
         
     | 
| 
      
 38 
     | 
    
         
            +
                  this_many.times do |offset|
         
     | 
| 
      
 39 
     | 
    
         
            +
                    yield self[offset, length]
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  this_many += 1
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -5,15 +5,18 @@ class Symbol # :nodoc:all 
     | 
|
| 
       5 
5 
     | 
    
         
             
              # :keys.each_subtoken    # => yields each of [:keys, :key, :ke, :k]
         
     | 
| 
       6 
6 
     | 
    
         
             
              # :keys.each_subtoken(2) # => yields each of [:keys, :key, :ke]
         
     | 
| 
       7 
7 
     | 
    
         
             
              #
         
     | 
| 
       8 
     | 
    
         
            -
              def each_subtoken from_length = 1
         
     | 
| 
      
 8 
     | 
    
         
            +
              def each_subtoken from_length = 1, range = nil
         
     | 
| 
       9 
9 
     | 
    
         
             
                sub = self.id2name
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
                sub = sub[range] if range
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                yield sub.intern
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       11 
15 
     | 
    
         
             
                size = sub.size
         
     | 
| 
       12 
16 
     | 
    
         
             
                from_length = size + from_length + 1 if from_length < 0
         
     | 
| 
       13 
17 
     | 
    
         
             
                from_length = size if size < from_length
         
     | 
| 
       14 
18 
     | 
    
         
             
                from_length = 1 if from_length < 1
         
     | 
| 
       15 
19 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
                yield self
         
     | 
| 
       17 
20 
     | 
    
         
             
                size.downto(from_length + 1) { yield sub.chop!.intern }
         
     | 
| 
       18 
21 
     | 
    
         
             
              end
         
     | 
| 
       19 
22 
     | 
    
         | 
| 
         @@ -20,11 +20,13 @@ module Picky 
     | 
|
| 
       20 
20 
     | 
    
         
             
                      else
         
     | 
| 
       21 
21 
     | 
    
         
             
                        if @from < 0 && @to < 0
         
     | 
| 
       22 
22 
     | 
    
         
             
                          def each_subtoken token, &block
         
     | 
| 
       23 
     | 
    
         
            -
                            token 
     | 
| 
      
 23 
     | 
    
         
            +
                            token.each_subtoken @from - @to - 1, (0..@to), &block
         
     | 
| 
      
 24 
     | 
    
         
            +
                            # token[0..@to].intern.each_subtoken @from - @to - 1, &block # TODO to_sym
         
     | 
| 
       24 
25 
     | 
    
         
             
                          end
         
     | 
| 
       25 
26 
     | 
    
         
             
                        else
         
     | 
| 
       26 
27 
     | 
    
         
             
                          def each_subtoken token, &block
         
     | 
| 
       27 
     | 
    
         
            -
                            token 
     | 
| 
      
 28 
     | 
    
         
            +
                            token.each_subtoken @from, (0..@to), &block
         
     | 
| 
      
 29 
     | 
    
         
            +
                            # token[0..@to].intern.each_subtoken @from, &block # TODO to_sym
         
     | 
| 
       28 
30 
     | 
    
         
             
                          end
         
     | 
| 
       29 
31 
     | 
    
         
             
                        end
         
     | 
| 
       30 
32 
     | 
    
         
             
                      end
         
     | 
    
        data/lib/picky/loader.rb
    CHANGED
    
    | 
         @@ -56,6 +56,7 @@ module Picky 
     | 
|
| 
       56 
56 
     | 
    
         
             
                  load_relative 'extensions/object'
         
     | 
| 
       57 
57 
     | 
    
         
             
                  load_relative 'extensions/array'
         
     | 
| 
       58 
58 
     | 
    
         
             
                  load_relative 'extensions/symbol'
         
     | 
| 
      
 59 
     | 
    
         
            +
                  load_relative 'extensions/string'
         
     | 
| 
       59 
60 
     | 
    
         
             
                  load_relative 'extensions/module'
         
     | 
| 
       60 
61 
     | 
    
         
             
                  load_relative 'extensions/class'
         
     | 
| 
       61 
62 
     | 
    
         
             
                  load_relative 'extensions/hash'
         
     | 
    
        data/lib/picky/query/token.rb
    CHANGED
    
    
| 
         @@ -12,6 +12,32 @@ describe Picky::Backends::Redis do 
     | 
|
| 
       12 
12 
     | 
    
         
             
                  @backend.stub! :timed_exclaim
         
     | 
| 
       13 
13 
     | 
    
         
             
                end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
                describe "redis_with_scripting?" do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  let(:client) { stub :client}
         
     | 
| 
      
 17 
     | 
    
         
            +
                  let(:redis) { described_class.new client: client }
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  it "answers correctly" do
         
     | 
| 
      
 20 
     | 
    
         
            +
                    client.stub! :info => {"redis_version"=>"2.2.2", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                    redis.redis_with_scripting?.should == false
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                  it "answers correctly" do
         
     | 
| 
      
 25 
     | 
    
         
            +
                    client.stub! :info => {"redis_version"=>"2.6.0", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    redis.redis_with_scripting?.should == true
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
                  it "answers correctly" do
         
     | 
| 
      
 30 
     | 
    
         
            +
                    client.stub! :info => {:redis_version=>"2.2.2", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    redis.redis_with_scripting?.should == false
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                  it "answers correctly" do
         
     | 
| 
      
 35 
     | 
    
         
            +
                    client.stub! :info => {:redis_version=>"2.6.0", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "arch_bits"=>"64", "multiplexing_api"=>"kqueue", "process_id"=>"70364", "uptime_in_seconds"=>"86804", "uptime_in_days"=>"1", "lru_clock"=>"2057342", "used_cpu_sys"=>"12.76", "used_cpu_user"=>"13.44", "used_cpu_sys_childrens"=>"0.62", "used_cpu_user_childrens"=>"0.30", "connected_clients"=>"1", "connected_slaves"=>"0", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"34389632", "used_memory_human"=>"32.80M", "used_memory_rss"=>"675840", "mem_fragmentation_ratio"=>"0.02", "use_tcmalloc"=>"0", "loading"=>"0", "aof_enabled"=>"0", "changes_since_last_save"=>"0", "bgsave_in_progress"=>"0", "last_save_time"=>"1320721195", "bgrewriteaof_in_progress"=>"0", "total_connections_received"=>"20", "total_commands_processed"=>"327594", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"218584", "keyspace_misses"=>"98664", "hash_max_zipmap_entries"=>"512", "hash_max_zipmap_value"=>"64", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "vm_enabled"=>"0", "role"=>"master", "allocation_stats"=>"2=74,6=1,8=15,9=156,10=142939,11=104891,12=290902,13=263791,14=14570,15=29143,16=1661979,17=8986,18=6370,19=4508,20=18010,21=1622,22=1136,23=544,24=419271,25=154,26=73,27=32,28=30,29=14,32=419046,33=6,34=7,35=15,36=10,37=12,38=625,39=7127,40=207716,41=40840,42=7246,43=2645,44=28390,45=37835,46=35164,47=67465,48=54765,49=41247,50=44391,51=36420,52=29582,53=21491,54=18575,55=14101,56=61954,57=5476,58=3246,59=2227,60=1502,61=868,62=541,63=282,64=69006,65=87,66=58,67=32,68=30,69=6,70=2,71=5,72=12723,74=19,75=2,76=13,77=6,80=12500,81=10,82=4,83=8,84=10,85=14,86=5,87=37,88=97714,89=58,91=30,93=68,94=14,95=35,97=56,99=46,101=24,103=17,104=846,105=1,106=15,107=19,109=4,110=6,111=13,113=8,114=8,115=4,116=5,117=8,118=11,119=4,120=217,121=18,122=6,125=5,126=12,128=4411,131=12,133=8,136=57,137=14,138=10,142=6,143=4,145=6,147=14,150=4,152=23,153=6,157=4,158=6,159=14,163=8,164=18,166=4,168=6,169=1,170=16,171=27,173=7,174=10,175=31,177=14,178=6,179=13,181=39,182=4,183=12,184=7,185=42,187=16,189=69,191=22,193=17,195=8,196=16,197=23,199=20,201=23,203=12,205=4,206=16,207=6,208=4,209=10,211=1,213=8,215=4,216=10,217=4,218=14,219=10,221=14,223=4,225=8,226=6,227=4,228=10,230=10,232=6,234=6,237=4,238=6,239=8,240=6,241=4,242=6,245=6,248=4,249=16,250=6,252=4,253=4,>=256=113463", "db15"=>"keys=26605,expires=0"}
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                    redis.redis_with_scripting?.should == true
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
       15 
41 
     | 
    
         
             
                describe 'create_...' do
         
     | 
| 
       16 
42 
     | 
    
         
             
                  [
         
     | 
| 
       17 
43 
     | 
    
         
             
                    [:inverted,      Picky::Backends::Redis::Float],
         
     | 
| 
         @@ -0,0 +1,492 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe String do
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              context 'performance' do
         
     | 
| 
      
 8 
     | 
    
         
            +
                include Picky::Helpers::Measuring
         
     | 
| 
      
 9 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @token = (((0..9).to_a)*10).to_s.to_sym
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
                it "is fast" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  performance_of { @token.each_subtoken { |subtoken| } }.should < 0.00065
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
                it 'is fast enough' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  performance_of { @token.each_intoken { |intoken| } }.should < 0.025 # TODO Slow!
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              describe 'each_intoken' do
         
     | 
| 
      
 21 
     | 
    
         
            +
                context 'normal String' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 23 
     | 
    
         
            +
                    @str = "picky"
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  context 'no params' do
         
     | 
| 
      
 26 
     | 
    
         
            +
                    it "yields the right elements" do
         
     | 
| 
      
 27 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 28 
     | 
    
         
            +
                      @str.each_intoken do |subtoken|
         
     | 
| 
      
 29 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 30 
     | 
    
         
            +
                      end
         
     | 
| 
      
 31 
     | 
    
         
            +
                      result.should == ['picky', 'pick', 'icky', 'pic', 'ick', 'cky', 'pi', 'ic', 'ck', 'ky', 'p', 'i', 'c', 'k', 'y']
         
     | 
| 
      
 32 
     | 
    
         
            +
                    end
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                  context 'with min_length == 0' do
         
     | 
| 
      
 35 
     | 
    
         
            +
                    it "yields the right elements" do
         
     | 
| 
      
 36 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 37 
     | 
    
         
            +
                      @str.each_intoken(0) do |subtoken|
         
     | 
| 
      
 38 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 39 
     | 
    
         
            +
                      end
         
     | 
| 
      
 40 
     | 
    
         
            +
                      result.should == ['picky', 'pick', 'icky', 'pic', 'ick', 'cky', 'pi', 'ic', 'ck', 'ky', 'p', 'i', 'c', 'k', 'y']
         
     | 
| 
      
 41 
     | 
    
         
            +
                    end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    context 'max_length == 0' do
         
     | 
| 
      
 43 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 44 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 45 
     | 
    
         
            +
                        @str.each_intoken(0, 0) do |subtoken|
         
     | 
| 
      
 46 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 47 
     | 
    
         
            +
                        end
         
     | 
| 
      
 48 
     | 
    
         
            +
                        result.should == ['p', 'i', 'c', 'k', 'y']
         
     | 
| 
      
 49 
     | 
    
         
            +
                      end
         
     | 
| 
      
 50 
     | 
    
         
            +
                    end
         
     | 
| 
      
 51 
     | 
    
         
            +
                    context 'max_length == 1' do
         
     | 
| 
      
 52 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 53 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 54 
     | 
    
         
            +
                        @str.each_intoken(0, 1) do |subtoken|
         
     | 
| 
      
 55 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 56 
     | 
    
         
            +
                        end
         
     | 
| 
      
 57 
     | 
    
         
            +
                        result.should == ['p', 'i', 'c', 'k', 'y']
         
     | 
| 
      
 58 
     | 
    
         
            +
                      end
         
     | 
| 
      
 59 
     | 
    
         
            +
                    end
         
     | 
| 
      
 60 
     | 
    
         
            +
                    context 'max_length == 2' do
         
     | 
| 
      
 61 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 62 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 63 
     | 
    
         
            +
                        @str.each_intoken(0, 2) do |subtoken|
         
     | 
| 
      
 64 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 65 
     | 
    
         
            +
                        end
         
     | 
| 
      
 66 
     | 
    
         
            +
                        result.should == ['pi', 'ic', 'ck', 'ky', 'p', 'i', 'c', 'k', 'y']
         
     | 
| 
      
 67 
     | 
    
         
            +
                      end
         
     | 
| 
      
 68 
     | 
    
         
            +
                    end
         
     | 
| 
      
 69 
     | 
    
         
            +
                    context 'max_length == 10' do
         
     | 
| 
      
 70 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 71 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 72 
     | 
    
         
            +
                        @str.each_intoken(0, 10) do |subtoken|
         
     | 
| 
      
 73 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 74 
     | 
    
         
            +
                        end
         
     | 
| 
      
 75 
     | 
    
         
            +
                        result.should == ['picky', 'pick', 'icky', 'pic', 'ick', 'cky', 'pi', 'ic', 'ck', 'ky', 'p', 'i', 'c', 'k', 'y']
         
     | 
| 
      
 76 
     | 
    
         
            +
                      end
         
     | 
| 
      
 77 
     | 
    
         
            +
                    end
         
     | 
| 
      
 78 
     | 
    
         
            +
                    context 'max_length == -1' do
         
     | 
| 
      
 79 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 80 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 81 
     | 
    
         
            +
                        @str.each_intoken(0, -1) do |subtoken|
         
     | 
| 
      
 82 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 83 
     | 
    
         
            +
                        end
         
     | 
| 
      
 84 
     | 
    
         
            +
                        result.should == ['picky', 'pick', 'icky', 'pic', 'ick', 'cky', 'pi', 'ic', 'ck', 'ky', 'p', 'i', 'c', 'k', 'y']
         
     | 
| 
      
 85 
     | 
    
         
            +
                      end
         
     | 
| 
      
 86 
     | 
    
         
            +
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
                  end
         
     | 
| 
      
 88 
     | 
    
         
            +
                  context 'with min_length == sym.size' do
         
     | 
| 
      
 89 
     | 
    
         
            +
                    it "yields the right elements" do
         
     | 
| 
      
 90 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 91 
     | 
    
         
            +
                      @str.each_intoken(@str.size) do |subtoken|
         
     | 
| 
      
 92 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 93 
     | 
    
         
            +
                      end
         
     | 
| 
      
 94 
     | 
    
         
            +
                      result.should == ['picky']
         
     | 
| 
      
 95 
     | 
    
         
            +
                    end
         
     | 
| 
      
 96 
     | 
    
         
            +
                    context 'max_length == 0' do
         
     | 
| 
      
 97 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 98 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 99 
     | 
    
         
            +
                        @str.each_intoken(@str.size, 0) do |subtoken|
         
     | 
| 
      
 100 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 101 
     | 
    
         
            +
                        end
         
     | 
| 
      
 102 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 103 
     | 
    
         
            +
                      end
         
     | 
| 
      
 104 
     | 
    
         
            +
                    end
         
     | 
| 
      
 105 
     | 
    
         
            +
                    context 'max_length == 1' do
         
     | 
| 
      
 106 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 107 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 108 
     | 
    
         
            +
                        @str.each_intoken(@str.size, 1) do |subtoken|
         
     | 
| 
      
 109 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 110 
     | 
    
         
            +
                        end
         
     | 
| 
      
 111 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 112 
     | 
    
         
            +
                      end
         
     | 
| 
      
 113 
     | 
    
         
            +
                    end
         
     | 
| 
      
 114 
     | 
    
         
            +
                    context 'max_length == 2' do
         
     | 
| 
      
 115 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 116 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 117 
     | 
    
         
            +
                        @str.each_intoken(@str.size, 2) do |subtoken|
         
     | 
| 
      
 118 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 119 
     | 
    
         
            +
                        end
         
     | 
| 
      
 120 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 121 
     | 
    
         
            +
                      end
         
     | 
| 
      
 122 
     | 
    
         
            +
                    end
         
     | 
| 
      
 123 
     | 
    
         
            +
                    context 'max_length == 10' do
         
     | 
| 
      
 124 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 125 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 126 
     | 
    
         
            +
                        @str.each_intoken(@str.size, 10) do |subtoken|
         
     | 
| 
      
 127 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 128 
     | 
    
         
            +
                        end
         
     | 
| 
      
 129 
     | 
    
         
            +
                        result.should == ['picky']
         
     | 
| 
      
 130 
     | 
    
         
            +
                      end
         
     | 
| 
      
 131 
     | 
    
         
            +
                    end
         
     | 
| 
      
 132 
     | 
    
         
            +
                    context 'max_length == -1' do
         
     | 
| 
      
 133 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 134 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 135 
     | 
    
         
            +
                        @str.each_intoken(@str.size, -1) do |subtoken|
         
     | 
| 
      
 136 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 137 
     | 
    
         
            +
                        end
         
     | 
| 
      
 138 
     | 
    
         
            +
                        result.should == ['picky']
         
     | 
| 
      
 139 
     | 
    
         
            +
                      end
         
     | 
| 
      
 140 
     | 
    
         
            +
                    end
         
     | 
| 
      
 141 
     | 
    
         
            +
                  end
         
     | 
| 
      
 142 
     | 
    
         
            +
                  context 'with min_length > sym.size' do
         
     | 
| 
      
 143 
     | 
    
         
            +
                    it "yields the right elements" do
         
     | 
| 
      
 144 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 145 
     | 
    
         
            +
                      @str.each_intoken(@str.size+1) do |subtoken|
         
     | 
| 
      
 146 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 147 
     | 
    
         
            +
                      end
         
     | 
| 
      
 148 
     | 
    
         
            +
                      result.should == []
         
     | 
| 
      
 149 
     | 
    
         
            +
                    end
         
     | 
| 
      
 150 
     | 
    
         
            +
                    context 'max_length == 0' do
         
     | 
| 
      
 151 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 152 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 153 
     | 
    
         
            +
                        @str.each_intoken(@str.size+1, 0) do |subtoken|
         
     | 
| 
      
 154 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 155 
     | 
    
         
            +
                        end
         
     | 
| 
      
 156 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 157 
     | 
    
         
            +
                      end
         
     | 
| 
      
 158 
     | 
    
         
            +
                    end
         
     | 
| 
      
 159 
     | 
    
         
            +
                    context 'max_length == 1' do
         
     | 
| 
      
 160 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 161 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 162 
     | 
    
         
            +
                        @str.each_intoken(@str.size+1, 1) do |subtoken|
         
     | 
| 
      
 163 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 164 
     | 
    
         
            +
                        end
         
     | 
| 
      
 165 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 166 
     | 
    
         
            +
                      end
         
     | 
| 
      
 167 
     | 
    
         
            +
                    end
         
     | 
| 
      
 168 
     | 
    
         
            +
                    context 'max_length == 2' do
         
     | 
| 
      
 169 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 170 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 171 
     | 
    
         
            +
                        @str.each_intoken(@str.size+1, 2) do |subtoken|
         
     | 
| 
      
 172 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 173 
     | 
    
         
            +
                        end
         
     | 
| 
      
 174 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 175 
     | 
    
         
            +
                      end
         
     | 
| 
      
 176 
     | 
    
         
            +
                    end
         
     | 
| 
      
 177 
     | 
    
         
            +
                    context 'max_length == 10' do
         
     | 
| 
      
 178 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 179 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 180 
     | 
    
         
            +
                        @str.each_intoken(@str.size+1, 10) do |subtoken|
         
     | 
| 
      
 181 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 182 
     | 
    
         
            +
                        end
         
     | 
| 
      
 183 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 184 
     | 
    
         
            +
                      end
         
     | 
| 
      
 185 
     | 
    
         
            +
                    end
         
     | 
| 
      
 186 
     | 
    
         
            +
                    context 'max_length == -1' do
         
     | 
| 
      
 187 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 188 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 189 
     | 
    
         
            +
                        @str.each_intoken(@str.size+1, -1) do |subtoken|
         
     | 
| 
      
 190 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 191 
     | 
    
         
            +
                        end
         
     | 
| 
      
 192 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 193 
     | 
    
         
            +
                      end
         
     | 
| 
      
 194 
     | 
    
         
            +
                    end
         
     | 
| 
      
 195 
     | 
    
         
            +
                  end
         
     | 
| 
      
 196 
     | 
    
         
            +
                  context 'with min_length < 0' do
         
     | 
| 
      
 197 
     | 
    
         
            +
                    it "yields the right elements" do
         
     | 
| 
      
 198 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 199 
     | 
    
         
            +
                      @str.each_intoken(-2) do |subtoken|
         
     | 
| 
      
 200 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 201 
     | 
    
         
            +
                      end
         
     | 
| 
      
 202 
     | 
    
         
            +
                      result.should == ['picky', 'pick', 'icky']
         
     | 
| 
      
 203 
     | 
    
         
            +
                    end
         
     | 
| 
      
 204 
     | 
    
         
            +
                    context 'max_length == 0' do
         
     | 
| 
      
 205 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 206 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 207 
     | 
    
         
            +
                        @str.each_intoken(-2, 0) do |subtoken|
         
     | 
| 
      
 208 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 209 
     | 
    
         
            +
                        end
         
     | 
| 
      
 210 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 211 
     | 
    
         
            +
                      end
         
     | 
| 
      
 212 
     | 
    
         
            +
                    end
         
     | 
| 
      
 213 
     | 
    
         
            +
                    context 'max_length == 1' do
         
     | 
| 
      
 214 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 215 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 216 
     | 
    
         
            +
                        @str.each_intoken(-2, 1) do |subtoken|
         
     | 
| 
      
 217 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 218 
     | 
    
         
            +
                        end
         
     | 
| 
      
 219 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 220 
     | 
    
         
            +
                      end
         
     | 
| 
      
 221 
     | 
    
         
            +
                    end
         
     | 
| 
      
 222 
     | 
    
         
            +
                    context 'max_length == 2' do
         
     | 
| 
      
 223 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 224 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 225 
     | 
    
         
            +
                        @str.each_intoken(-2, 2) do |subtoken|
         
     | 
| 
      
 226 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 227 
     | 
    
         
            +
                        end
         
     | 
| 
      
 228 
     | 
    
         
            +
                        result.should == []
         
     | 
| 
      
 229 
     | 
    
         
            +
                      end
         
     | 
| 
      
 230 
     | 
    
         
            +
                    end
         
     | 
| 
      
 231 
     | 
    
         
            +
                    context 'max_length == 10' do
         
     | 
| 
      
 232 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 233 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 234 
     | 
    
         
            +
                        @str.each_intoken(-2, 10) do |subtoken|
         
     | 
| 
      
 235 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 236 
     | 
    
         
            +
                        end
         
     | 
| 
      
 237 
     | 
    
         
            +
                        result.should == ['picky', 'pick', 'icky']
         
     | 
| 
      
 238 
     | 
    
         
            +
                      end
         
     | 
| 
      
 239 
     | 
    
         
            +
                    end
         
     | 
| 
      
 240 
     | 
    
         
            +
                    context 'max_length == -1' do
         
     | 
| 
      
 241 
     | 
    
         
            +
                      it 'yields the right elements' do
         
     | 
| 
      
 242 
     | 
    
         
            +
                        result = []
         
     | 
| 
      
 243 
     | 
    
         
            +
                        @str.each_intoken(-2, -1) do |subtoken|
         
     | 
| 
      
 244 
     | 
    
         
            +
                          result << subtoken
         
     | 
| 
      
 245 
     | 
    
         
            +
                        end
         
     | 
| 
      
 246 
     | 
    
         
            +
                        result.should == ['picky', 'pick', 'icky']
         
     | 
| 
      
 247 
     | 
    
         
            +
                      end
         
     | 
| 
      
 248 
     | 
    
         
            +
                    end
         
     | 
| 
      
 249 
     | 
    
         
            +
                  end
         
     | 
| 
      
 250 
     | 
    
         
            +
                end
         
     | 
| 
      
 251 
     | 
    
         
            +
              end
         
     | 
| 
      
 252 
     | 
    
         
            +
             
     | 
| 
      
 253 
     | 
    
         
            +
              describe "each_subtoken" do
         
     | 
| 
      
 254 
     | 
    
         
            +
                context 'normal String' do
         
     | 
| 
      
 255 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 256 
     | 
    
         
            +
                    @str = 'reinke'
         
     | 
| 
      
 257 
     | 
    
         
            +
                  end
         
     | 
| 
      
 258 
     | 
    
         
            +
                  context 'no downto' do
         
     | 
| 
      
 259 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 260 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 261 
     | 
    
         
            +
                      @str.each_subtoken do |subtoken|
         
     | 
| 
      
 262 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 263 
     | 
    
         
            +
                      end
         
     | 
| 
      
 264 
     | 
    
         
            +
                      result.should == ['reinke', 'reink', 'rein', 'rei', 're', 'r']
         
     | 
| 
      
 265 
     | 
    
         
            +
                    end
         
     | 
| 
      
 266 
     | 
    
         
            +
                  end
         
     | 
| 
      
 267 
     | 
    
         
            +
                  context 'downto is larger than the String' do
         
     | 
| 
      
 268 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 269 
     | 
    
         
            +
                      @downto = 8
         
     | 
| 
      
 270 
     | 
    
         
            +
                    end
         
     | 
| 
      
 271 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 272 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 273 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 274 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 275 
     | 
    
         
            +
                      end
         
     | 
| 
      
 276 
     | 
    
         
            +
                      result.should == ['reinke']
         
     | 
| 
      
 277 
     | 
    
         
            +
                    end
         
     | 
| 
      
 278 
     | 
    
         
            +
                  end
         
     | 
| 
      
 279 
     | 
    
         
            +
                  context 'downto is exactly the same as String' do
         
     | 
| 
      
 280 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 281 
     | 
    
         
            +
                      @downto = 6
         
     | 
| 
      
 282 
     | 
    
         
            +
                    end
         
     | 
| 
      
 283 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 284 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 285 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 286 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 287 
     | 
    
         
            +
                      end
         
     | 
| 
      
 288 
     | 
    
         
            +
                      result.should == ['reinke']
         
     | 
| 
      
 289 
     | 
    
         
            +
                    end
         
     | 
| 
      
 290 
     | 
    
         
            +
                  end
         
     | 
| 
      
 291 
     | 
    
         
            +
                  context 'downto is smaller than the length of the String' do
         
     | 
| 
      
 292 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 293 
     | 
    
         
            +
                      @downto = 4
         
     | 
| 
      
 294 
     | 
    
         
            +
                    end
         
     | 
| 
      
 295 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 296 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 297 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 298 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 299 
     | 
    
         
            +
                      end
         
     | 
| 
      
 300 
     | 
    
         
            +
                      result.should == ['reinke', 'reink', 'rein']
         
     | 
| 
      
 301 
     | 
    
         
            +
                    end
         
     | 
| 
      
 302 
     | 
    
         
            +
                  end
         
     | 
| 
      
 303 
     | 
    
         
            +
                  context 'downto is 1' do
         
     | 
| 
      
 304 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 305 
     | 
    
         
            +
                      @downto = 1
         
     | 
| 
      
 306 
     | 
    
         
            +
                    end
         
     | 
| 
      
 307 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 308 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 309 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 310 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 311 
     | 
    
         
            +
                      end
         
     | 
| 
      
 312 
     | 
    
         
            +
                      result.should == ['reinke', 'reink', 'rein', 'rei', 're', 'r']
         
     | 
| 
      
 313 
     | 
    
         
            +
                    end
         
     | 
| 
      
 314 
     | 
    
         
            +
                  end
         
     | 
| 
      
 315 
     | 
    
         
            +
                  context 'downto is 0' do
         
     | 
| 
      
 316 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 317 
     | 
    
         
            +
                      @downto = 0
         
     | 
| 
      
 318 
     | 
    
         
            +
                    end
         
     | 
| 
      
 319 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 320 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 321 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 322 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 323 
     | 
    
         
            +
                      end
         
     | 
| 
      
 324 
     | 
    
         
            +
                      result.should == ['reinke', 'reink', 'rein', 'rei', 're', 'r']
         
     | 
| 
      
 325 
     | 
    
         
            +
                    end
         
     | 
| 
      
 326 
     | 
    
         
            +
                  end
         
     | 
| 
      
 327 
     | 
    
         
            +
                  context 'downto is less than zero' do
         
     | 
| 
      
 328 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 329 
     | 
    
         
            +
                      @downto = -2
         
     | 
| 
      
 330 
     | 
    
         
            +
                    end
         
     | 
| 
      
 331 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 332 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 333 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 334 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 335 
     | 
    
         
            +
                      end
         
     | 
| 
      
 336 
     | 
    
         
            +
                      result.should == ['reinke', 'reink']
         
     | 
| 
      
 337 
     | 
    
         
            +
                    end
         
     | 
| 
      
 338 
     | 
    
         
            +
                  end
         
     | 
| 
      
 339 
     | 
    
         
            +
                end
         
     | 
| 
      
 340 
     | 
    
         
            +
                context 'japanese String' do
         
     | 
| 
      
 341 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 342 
     | 
    
         
            +
                    @str = :日本語
         
     | 
| 
      
 343 
     | 
    
         
            +
                  end
         
     | 
| 
      
 344 
     | 
    
         
            +
                  it "should return an array of japanese Strings, each 1 smaller than the other" do
         
     | 
| 
      
 345 
     | 
    
         
            +
                    result = []
         
     | 
| 
      
 346 
     | 
    
         
            +
                    @str.each_subtoken do |subtoken|
         
     | 
| 
      
 347 
     | 
    
         
            +
                      result << subtoken
         
     | 
| 
      
 348 
     | 
    
         
            +
                    end
         
     | 
| 
      
 349 
     | 
    
         
            +
                    result.should == [:日本語, :日本, :日]
         
     | 
| 
      
 350 
     | 
    
         
            +
                  end
         
     | 
| 
      
 351 
     | 
    
         
            +
                end
         
     | 
| 
      
 352 
     | 
    
         
            +
                context 'very short String' do
         
     | 
| 
      
 353 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 354 
     | 
    
         
            +
                    @str = 'r'
         
     | 
| 
      
 355 
     | 
    
         
            +
                  end
         
     | 
| 
      
 356 
     | 
    
         
            +
                  context 'no downto' do
         
     | 
| 
      
 357 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 358 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 359 
     | 
    
         
            +
                      @str.each_subtoken do |subtoken|
         
     | 
| 
      
 360 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 361 
     | 
    
         
            +
                      end
         
     | 
| 
      
 362 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 363 
     | 
    
         
            +
                    end
         
     | 
| 
      
 364 
     | 
    
         
            +
                  end
         
     | 
| 
      
 365 
     | 
    
         
            +
                  context 'downto is larger than the String' do
         
     | 
| 
      
 366 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 367 
     | 
    
         
            +
                      @downto = 8
         
     | 
| 
      
 368 
     | 
    
         
            +
                    end
         
     | 
| 
      
 369 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 370 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 371 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 372 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 373 
     | 
    
         
            +
                      end
         
     | 
| 
      
 374 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 375 
     | 
    
         
            +
                    end
         
     | 
| 
      
 376 
     | 
    
         
            +
                  end
         
     | 
| 
      
 377 
     | 
    
         
            +
                  context 'downto is exactly the same as String' do
         
     | 
| 
      
 378 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 379 
     | 
    
         
            +
                      @downto = 6
         
     | 
| 
      
 380 
     | 
    
         
            +
                    end
         
     | 
| 
      
 381 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 382 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 383 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 384 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 385 
     | 
    
         
            +
                      end
         
     | 
| 
      
 386 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 387 
     | 
    
         
            +
                    end
         
     | 
| 
      
 388 
     | 
    
         
            +
                  end
         
     | 
| 
      
 389 
     | 
    
         
            +
                  context 'downto is smaller than the length of the String' do
         
     | 
| 
      
 390 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 391 
     | 
    
         
            +
                      @downto = 4
         
     | 
| 
      
 392 
     | 
    
         
            +
                    end
         
     | 
| 
      
 393 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 394 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 395 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 396 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 397 
     | 
    
         
            +
                      end
         
     | 
| 
      
 398 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 399 
     | 
    
         
            +
                    end
         
     | 
| 
      
 400 
     | 
    
         
            +
                  end
         
     | 
| 
      
 401 
     | 
    
         
            +
                  context 'downto is 1' do
         
     | 
| 
      
 402 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 403 
     | 
    
         
            +
                      @downto = 1
         
     | 
| 
      
 404 
     | 
    
         
            +
                    end
         
     | 
| 
      
 405 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 406 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 407 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 408 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 409 
     | 
    
         
            +
                      end
         
     | 
| 
      
 410 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 411 
     | 
    
         
            +
                    end
         
     | 
| 
      
 412 
     | 
    
         
            +
                  end
         
     | 
| 
      
 413 
     | 
    
         
            +
                  context 'downto is 0' do
         
     | 
| 
      
 414 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 415 
     | 
    
         
            +
                      @downto = 0
         
     | 
| 
      
 416 
     | 
    
         
            +
                    end
         
     | 
| 
      
 417 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 418 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 419 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 420 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 421 
     | 
    
         
            +
                      end
         
     | 
| 
      
 422 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 423 
     | 
    
         
            +
                    end
         
     | 
| 
      
 424 
     | 
    
         
            +
                  end
         
     | 
| 
      
 425 
     | 
    
         
            +
                  context 'downto is less than zero' do
         
     | 
| 
      
 426 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 427 
     | 
    
         
            +
                      @downto = -1
         
     | 
| 
      
 428 
     | 
    
         
            +
                    end
         
     | 
| 
      
 429 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 430 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 431 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 432 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 433 
     | 
    
         
            +
                      end
         
     | 
| 
      
 434 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 435 
     | 
    
         
            +
                    end
         
     | 
| 
      
 436 
     | 
    
         
            +
                  end
         
     | 
| 
      
 437 
     | 
    
         
            +
                  context 'downto is less than zero' do
         
     | 
| 
      
 438 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 439 
     | 
    
         
            +
                      @downto = -2
         
     | 
| 
      
 440 
     | 
    
         
            +
                    end
         
     | 
| 
      
 441 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 442 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 443 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 444 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 445 
     | 
    
         
            +
                      end
         
     | 
| 
      
 446 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 447 
     | 
    
         
            +
                    end
         
     | 
| 
      
 448 
     | 
    
         
            +
                  end
         
     | 
| 
      
 449 
     | 
    
         
            +
                  context 'downto is less than zero' do
         
     | 
| 
      
 450 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 451 
     | 
    
         
            +
                      @downto = -3
         
     | 
| 
      
 452 
     | 
    
         
            +
                    end
         
     | 
| 
      
 453 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 454 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 455 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 456 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 457 
     | 
    
         
            +
                      end
         
     | 
| 
      
 458 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 459 
     | 
    
         
            +
                    end
         
     | 
| 
      
 460 
     | 
    
         
            +
                  end
         
     | 
| 
      
 461 
     | 
    
         
            +
                  context 'downto is less than zero' do
         
     | 
| 
      
 462 
     | 
    
         
            +
                    before(:each) do
         
     | 
| 
      
 463 
     | 
    
         
            +
                      @downto = -100
         
     | 
| 
      
 464 
     | 
    
         
            +
                    end
         
     | 
| 
      
 465 
     | 
    
         
            +
                    it "should return an array of pieces of the original token, each 1 smaller than the other" do
         
     | 
| 
      
 466 
     | 
    
         
            +
                      result = []
         
     | 
| 
      
 467 
     | 
    
         
            +
                      @str.each_subtoken(@downto) do |subtoken|
         
     | 
| 
      
 468 
     | 
    
         
            +
                        result << subtoken
         
     | 
| 
      
 469 
     | 
    
         
            +
                      end
         
     | 
| 
      
 470 
     | 
    
         
            +
                      result.should == ['r']
         
     | 
| 
      
 471 
     | 
    
         
            +
                    end
         
     | 
| 
      
 472 
     | 
    
         
            +
                  end
         
     | 
| 
      
 473 
     | 
    
         
            +
                end
         
     | 
| 
      
 474 
     | 
    
         
            +
                context "with range param" do
         
     | 
| 
      
 475 
     | 
    
         
            +
                  it "returns a subtoken array from a clipped original" do
         
     | 
| 
      
 476 
     | 
    
         
            +
                    result = []
         
     | 
| 
      
 477 
     | 
    
         
            +
                    'reinke'.each_subtoken 2, (0..3) do |subtoken|
         
     | 
| 
      
 478 
     | 
    
         
            +
                      result << subtoken
         
     | 
| 
      
 479 
     | 
    
         
            +
                    end
         
     | 
| 
      
 480 
     | 
    
         
            +
                    result.should == ['rein', 'rei', 're']
         
     | 
| 
      
 481 
     | 
    
         
            +
                  end
         
     | 
| 
      
 482 
     | 
    
         
            +
                  it "returns a subtoken array from a clipped original" do
         
     | 
| 
      
 483 
     | 
    
         
            +
                    result = []
         
     | 
| 
      
 484 
     | 
    
         
            +
                    'reinke'.each_subtoken 2, (1..-2) do |subtoken|
         
     | 
| 
      
 485 
     | 
    
         
            +
                      result << subtoken
         
     | 
| 
      
 486 
     | 
    
         
            +
                    end
         
     | 
| 
      
 487 
     | 
    
         
            +
                    result.should == ['eink', 'ein', 'ei']
         
     | 
| 
      
 488 
     | 
    
         
            +
                  end
         
     | 
| 
      
 489 
     | 
    
         
            +
                end
         
     | 
| 
      
 490 
     | 
    
         
            +
              end
         
     | 
| 
      
 491 
     | 
    
         
            +
             
     | 
| 
      
 492 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -3,7 +3,7 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            describe Symbol do
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       7 
7 
     | 
    
         
             
              context 'performance' do
         
     | 
| 
       8 
8 
     | 
    
         
             
                include Picky::Helpers::Measuring
         
     | 
| 
       9 
9 
     | 
    
         
             
                before(:each) do
         
     | 
| 
         @@ -16,7 +16,7 @@ describe Symbol do 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  performance_of { @token.each_intoken { |intoken| } }.should < 0.025 # TODO Slow!
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
              end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       20 
20 
     | 
    
         
             
              describe 'each_intoken' do
         
     | 
| 
       21 
21 
     | 
    
         
             
                context 'normal symbol' do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  before(:each) do
         
     | 
| 
         @@ -249,7 +249,7 @@ describe Symbol do 
     | 
|
| 
       249 
249 
     | 
    
         
             
                  end
         
     | 
| 
       250 
250 
     | 
    
         
             
                end
         
     | 
| 
       251 
251 
     | 
    
         
             
              end
         
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
      
 252 
     | 
    
         
            +
             
     | 
| 
       253 
253 
     | 
    
         
             
              describe "each_subtoken" do
         
     | 
| 
       254 
254 
     | 
    
         
             
                context 'normal symbol' do
         
     | 
| 
       255 
255 
     | 
    
         
             
                  before(:each) do
         
     | 
| 
         @@ -471,6 +471,22 @@ describe Symbol do 
     | 
|
| 
       471 
471 
     | 
    
         
             
                    end
         
     | 
| 
       472 
472 
     | 
    
         
             
                  end
         
     | 
| 
       473 
473 
     | 
    
         
             
                end
         
     | 
| 
      
 474 
     | 
    
         
            +
                context "with range param" do
         
     | 
| 
      
 475 
     | 
    
         
            +
                  it "returns a subtoken array from a clipped original" do
         
     | 
| 
      
 476 
     | 
    
         
            +
                    result = []
         
     | 
| 
      
 477 
     | 
    
         
            +
                    :reinke.each_subtoken 2, (0..3) do |subtoken|
         
     | 
| 
      
 478 
     | 
    
         
            +
                      result << subtoken
         
     | 
| 
      
 479 
     | 
    
         
            +
                    end
         
     | 
| 
      
 480 
     | 
    
         
            +
                    result.should == [:rein, :rei, :re]
         
     | 
| 
      
 481 
     | 
    
         
            +
                  end
         
     | 
| 
      
 482 
     | 
    
         
            +
                  it "returns a subtoken array from a clipped original" do
         
     | 
| 
      
 483 
     | 
    
         
            +
                    result = []
         
     | 
| 
      
 484 
     | 
    
         
            +
                    :reinke.each_subtoken 2, (1..-2) do |subtoken|
         
     | 
| 
      
 485 
     | 
    
         
            +
                      result << subtoken
         
     | 
| 
      
 486 
     | 
    
         
            +
                    end
         
     | 
| 
      
 487 
     | 
    
         
            +
                    result.should == [:eink, :ein, :ei]
         
     | 
| 
      
 488 
     | 
    
         
            +
                  end
         
     | 
| 
      
 489 
     | 
    
         
            +
                end
         
     | 
| 
       474 
490 
     | 
    
         
             
              end
         
     | 
| 
       475 
     | 
    
         
            -
             
     | 
| 
      
 491 
     | 
    
         
            +
             
     | 
| 
       476 
492 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # encoding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            #
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            describe "Regression" do
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              # # This was described by Niko
         
     | 
| 
      
 8 
     | 
    
         
            +
              # # and references a case where
         
     | 
| 
      
 9 
     | 
    
         
            +
              # # an attribute and the id referenced
         
     | 
| 
      
 10 
     | 
    
         
            +
              # # to the same String.
         
     | 
| 
      
 11 
     | 
    
         
            +
              # #
         
     | 
| 
      
 12 
     | 
    
         
            +
              # context 'fun cases' do
         
     | 
| 
      
 13 
     | 
    
         
            +
              #   it 'stopwords destroy ids (final: id reference on attribute)' do
         
     | 
| 
      
 14 
     | 
    
         
            +
              #     index = Picky::Index.new :stopwords do
         
     | 
| 
      
 15 
     | 
    
         
            +
              #       key_format :to_sym
         
     | 
| 
      
 16 
     | 
    
         
            +
              #       indexing splits_text_on: /[\\\/\s\"\'\&_,;:]+/i,
         
     | 
| 
      
 17 
     | 
    
         
            +
              #                stopwords: /\b(and|the|or|on|of|in|der|die|das|und|oder)\b/i
         
     | 
| 
      
 18 
     | 
    
         
            +
              #       category :text
         
     | 
| 
      
 19 
     | 
    
         
            +
              #     end
         
     | 
| 
      
 20 
     | 
    
         
            +
              #
         
     | 
| 
      
 21 
     | 
    
         
            +
              #     referenced = "this and that"
         
     | 
| 
      
 22 
     | 
    
         
            +
              #
         
     | 
| 
      
 23 
     | 
    
         
            +
              #     require 'ostruct'
         
     | 
| 
      
 24 
     | 
    
         
            +
              #
         
     | 
| 
      
 25 
     | 
    
         
            +
              #     thing = OpenStruct.new id: referenced, text: referenced
         
     | 
| 
      
 26 
     | 
    
         
            +
              #
         
     | 
| 
      
 27 
     | 
    
         
            +
              #     index.add thing
         
     | 
| 
      
 28 
     | 
    
         
            +
              #
         
     | 
| 
      
 29 
     | 
    
         
            +
              #     try = Picky::Search.new index
         
     | 
| 
      
 30 
     | 
    
         
            +
              #
         
     | 
| 
      
 31 
     | 
    
         
            +
              #     try.search("this").ids.should == ["this  that"]
         
     | 
| 
      
 32 
     | 
    
         
            +
              #   end
         
     | 
| 
      
 33 
     | 
    
         
            +
              # end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: picky
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.4.1
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,11 +9,11 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2011-11- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2011-11-09 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rspec
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &70307432765800 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -21,21 +21,21 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :development
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *70307432765800
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: picky-client
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &70307432765260 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ~>
         
     | 
| 
       31 
31 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       32 
     | 
    
         
            -
                    version: 3.4. 
     | 
| 
      
 32 
     | 
    
         
            +
                    version: 3.4.1
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :development
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *70307432765260
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: rack
         
     | 
| 
       38 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &70307432764800 !ruby/object:Gem::Requirement
         
     | 
| 
       39 
39 
     | 
    
         
             
                none: false
         
     | 
| 
       40 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       41 
41 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -43,10 +43,10 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       44 
44 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       45 
45 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *70307432764800
         
     | 
| 
       47 
47 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       48 
48 
     | 
    
         
             
              name: rack_fast_escape
         
     | 
| 
       49 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 49 
     | 
    
         
            +
              requirement: &70307432764280 !ruby/object:Gem::Requirement
         
     | 
| 
       50 
50 
     | 
    
         
             
                none: false
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
52 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -54,10 +54,10 @@ dependencies: 
     | 
|
| 
       54 
54 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       55 
55 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       56 
56 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       57 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 57 
     | 
    
         
            +
              version_requirements: *70307432764280
         
     | 
| 
       58 
58 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       59 
59 
     | 
    
         
             
              name: text
         
     | 
| 
       60 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 60 
     | 
    
         
            +
              requirement: &70307432763780 !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
                none: false
         
     | 
| 
       62 
62 
     | 
    
         
             
                requirements:
         
     | 
| 
       63 
63 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -65,10 +65,10 @@ dependencies: 
     | 
|
| 
       65 
65 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       66 
66 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       67 
67 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       68 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 68 
     | 
    
         
            +
              version_requirements: *70307432763780
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
70 
     | 
    
         
             
              name: yajl-ruby
         
     | 
| 
       71 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: &70307432763280 !ruby/object:Gem::Requirement
         
     | 
| 
       72 
72 
     | 
    
         
             
                none: false
         
     | 
| 
       73 
73 
     | 
    
         
             
                requirements:
         
     | 
| 
       74 
74 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -76,10 +76,10 @@ dependencies: 
     | 
|
| 
       76 
76 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       77 
77 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       78 
78 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       79 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 79 
     | 
    
         
            +
              version_requirements: *70307432763280
         
     | 
| 
       80 
80 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       81 
81 
     | 
    
         
             
              name: activesupport
         
     | 
| 
       82 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 82 
     | 
    
         
            +
              requirement: &70307432762740 !ruby/object:Gem::Requirement
         
     | 
| 
       83 
83 
     | 
    
         
             
                none: false
         
     | 
| 
       84 
84 
     | 
    
         
             
                requirements:
         
     | 
| 
       85 
85 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -87,10 +87,10 @@ dependencies: 
     | 
|
| 
       87 
87 
     | 
    
         
             
                    version: '3.0'
         
     | 
| 
       88 
88 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       89 
89 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       90 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 90 
     | 
    
         
            +
              version_requirements: *70307432762740
         
     | 
| 
       91 
91 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       92 
92 
     | 
    
         
             
              name: activerecord
         
     | 
| 
       93 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 93 
     | 
    
         
            +
              requirement: &70307432762180 !ruby/object:Gem::Requirement
         
     | 
| 
       94 
94 
     | 
    
         
             
                none: false
         
     | 
| 
       95 
95 
     | 
    
         
             
                requirements:
         
     | 
| 
       96 
96 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -98,10 +98,10 @@ dependencies: 
     | 
|
| 
       98 
98 
     | 
    
         
             
                    version: '3.0'
         
     | 
| 
       99 
99 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       100 
100 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       101 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 101 
     | 
    
         
            +
              version_requirements: *70307432762180
         
     | 
| 
       102 
102 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       103 
103 
     | 
    
         
             
              name: unicorn
         
     | 
| 
       104 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 104 
     | 
    
         
            +
              requirement: &70307432761720 !ruby/object:Gem::Requirement
         
     | 
| 
       105 
105 
     | 
    
         
             
                none: false
         
     | 
| 
       106 
106 
     | 
    
         
             
                requirements:
         
     | 
| 
       107 
107 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -109,10 +109,10 @@ dependencies: 
     | 
|
| 
       109 
109 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       110 
110 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       111 
111 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       112 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 112 
     | 
    
         
            +
              version_requirements: *70307432761720
         
     | 
| 
       113 
113 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       114 
114 
     | 
    
         
             
              name: sinatra
         
     | 
| 
       115 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 115 
     | 
    
         
            +
              requirement: &70307432761240 !ruby/object:Gem::Requirement
         
     | 
| 
       116 
116 
     | 
    
         
             
                none: false
         
     | 
| 
       117 
117 
     | 
    
         
             
                requirements:
         
     | 
| 
       118 
118 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -120,10 +120,10 @@ dependencies: 
     | 
|
| 
       120 
120 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       121 
121 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       122 
122 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       123 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 123 
     | 
    
         
            +
              version_requirements: *70307432761240
         
     | 
| 
       124 
124 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       125 
125 
     | 
    
         
             
              name: redis
         
     | 
| 
       126 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 126 
     | 
    
         
            +
              requirement: &70307432760800 !ruby/object:Gem::Requirement
         
     | 
| 
       127 
127 
     | 
    
         
             
                none: false
         
     | 
| 
       128 
128 
     | 
    
         
             
                requirements:
         
     | 
| 
       129 
129 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -131,10 +131,10 @@ dependencies: 
     | 
|
| 
       131 
131 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       132 
132 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       133 
133 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       134 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 134 
     | 
    
         
            +
              version_requirements: *70307432760800
         
     | 
| 
       135 
135 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       136 
136 
     | 
    
         
             
              name: mysql
         
     | 
| 
       137 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 137 
     | 
    
         
            +
              requirement: &70307432760320 !ruby/object:Gem::Requirement
         
     | 
| 
       138 
138 
     | 
    
         
             
                none: false
         
     | 
| 
       139 
139 
     | 
    
         
             
                requirements:
         
     | 
| 
       140 
140 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -142,7 +142,7 @@ dependencies: 
     | 
|
| 
       142 
142 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       143 
143 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       144 
144 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       145 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 145 
     | 
    
         
            +
              version_requirements: *70307432760320
         
     | 
| 
       146 
146 
     | 
    
         
             
            description: Fast Ruby semantic text search engine with comfortable single field interface.
         
     | 
| 
       147 
147 
     | 
    
         
             
            email: florian.hanke+picky@gmail.com
         
     | 
| 
       148 
148 
     | 
    
         
             
            executables:
         
     | 
| 
         @@ -198,6 +198,7 @@ files: 
     | 
|
| 
       198 
198 
     | 
    
         
             
            - lib/picky/extensions/hash.rb
         
     | 
| 
       199 
199 
     | 
    
         
             
            - lib/picky/extensions/module.rb
         
     | 
| 
       200 
200 
     | 
    
         
             
            - lib/picky/extensions/object.rb
         
     | 
| 
      
 201 
     | 
    
         
            +
            - lib/picky/extensions/string.rb
         
     | 
| 
       201 
202 
     | 
    
         
             
            - lib/picky/extensions/symbol.rb
         
     | 
| 
       202 
203 
     | 
    
         
             
            - lib/picky/frontend_adapters/rack.rb
         
     | 
| 
       203 
204 
     | 
    
         
             
            - lib/picky/generators/aliases.rb
         
     | 
| 
         @@ -313,6 +314,7 @@ files: 
     | 
|
| 
       313 
314 
     | 
    
         
             
            - spec/lib/extensions/hash_spec.rb
         
     | 
| 
       314 
315 
     | 
    
         
             
            - spec/lib/extensions/module_spec.rb
         
     | 
| 
       315 
316 
     | 
    
         
             
            - spec/lib/extensions/object_spec.rb
         
     | 
| 
      
 317 
     | 
    
         
            +
            - spec/lib/extensions/string_spec.rb
         
     | 
| 
       316 
318 
     | 
    
         
             
            - spec/lib/extensions/symbol_spec.rb
         
     | 
| 
       317 
319 
     | 
    
         
             
            - spec/lib/frontend_adapters/rack_spec.rb
         
     | 
| 
       318 
320 
     | 
    
         
             
            - spec/lib/generators/aliases_spec.rb
         
     | 
| 
         @@ -376,6 +378,7 @@ files: 
     | 
|
| 
       376 
378 
     | 
    
         
             
            - spec/lib/tasks/try_spec.rb
         
     | 
| 
       377 
379 
     | 
    
         
             
            - spec/lib/tokenizer_spec.rb
         
     | 
| 
       378 
380 
     | 
    
         
             
            - spec/specific/realtime_spec.rb
         
     | 
| 
      
 381 
     | 
    
         
            +
            - spec/specific/regression_spec.rb
         
     | 
| 
       379 
382 
     | 
    
         
             
            - spec/specific/speed_spec.rb
         
     | 
| 
       380 
383 
     | 
    
         
             
            - bin/picky
         
     | 
| 
       381 
384 
     | 
    
         
             
            homepage: http://florianhanke.com/picky
         
     | 
| 
         @@ -436,6 +439,7 @@ test_files: 
     | 
|
| 
       436 
439 
     | 
    
         
             
            - spec/lib/extensions/hash_spec.rb
         
     | 
| 
       437 
440 
     | 
    
         
             
            - spec/lib/extensions/module_spec.rb
         
     | 
| 
       438 
441 
     | 
    
         
             
            - spec/lib/extensions/object_spec.rb
         
     | 
| 
      
 442 
     | 
    
         
            +
            - spec/lib/extensions/string_spec.rb
         
     | 
| 
       439 
443 
     | 
    
         
             
            - spec/lib/extensions/symbol_spec.rb
         
     | 
| 
       440 
444 
     | 
    
         
             
            - spec/lib/frontend_adapters/rack_spec.rb
         
     | 
| 
       441 
445 
     | 
    
         
             
            - spec/lib/generators/aliases_spec.rb
         
     | 
| 
         @@ -499,4 +503,5 @@ test_files: 
     | 
|
| 
       499 
503 
     | 
    
         
             
            - spec/lib/tasks/try_spec.rb
         
     | 
| 
       500 
504 
     | 
    
         
             
            - spec/lib/tokenizer_spec.rb
         
     | 
| 
       501 
505 
     | 
    
         
             
            - spec/specific/realtime_spec.rb
         
     | 
| 
      
 506 
     | 
    
         
            +
            - spec/specific/regression_spec.rb
         
     | 
| 
       502 
507 
     | 
    
         
             
            - spec/specific/speed_spec.rb
         
     |