app/server/vendor/hamster/lib/hamster/trie.rb
# Returns a replacement instance after removing the specified key.
# If not found, returns <tt>self</tt>.
# If empty, returns <tt>nil</tt>.
Returns a replacement instance after removing the specified key.
If not found, returns self.
If empty, returns nil.
Returns a replacement instance after removing the specified key . If not found returns self . If empty returns nil .
def find_and_delete(key)
      index = index_for(key)
      entry = @entries[index]
      if entry && entry.key.eql?(key)
        return delete_at(index)
      else
        child = @children[index]
        if child
          copy = child.find_and_delete(key)
          unless copy.equal?(child)
            children = @children.dup
            children[index] = copy
            new_size = @size - (child.size - copy_size(copy))
            return self.class.new(@significant_bits, new_size, @entries, children)
          end
        end
      end
      self
    end
def find_and_delete ( key ) index = index_for ( key ) entry = @entries [ index ] if entry && entry . key . eql? ( key ) return delete_at ( index ) else child = @children [ index ] if child copy = child . find_and_delete ( key ) unless copy . equal? ( child ) children = @children . dup children [ index ] = copy new_size = @size - ( child . size - copy_size ( copy ) ) return self . class . new ( @significant_bits , new_size , @entries , children ) end end end self end
Returns a replacement instance after removing the specified key.
Returns a replacement instance after removing the specified key .
key
<not_specific>