Returns a hash with three keys actually used by the Autocomplete jQuery-ui
 Can be overriden to show whatever you like
 Hash also includes a key/value pair for each method in extra_data
963591
def json_for_autocomplete(items, method, extra_data=[])
      items = items.collect do |item|
        hash = HashWithIndifferentAccess.new({"id" => item.id.to_s, "label" => item.send(method), "value" => item.send(method)})
        extra_data.each do |datum|
          hash[datum] = item.send(datum)
        end if extra_data
        # TODO: Come back to remove this if clause when test suite is better
        hash
      end
      if block_given?
        yield(items)
      else
        items
      end
    end
908266
def typed_hash_key(*args, **kwargs):
    """"""

    key = hash_key(*args, **kwargs)
    key += tuple(type(v) for v in args)
    key += tuple(type(v) for _, v in sorted(kwargs.items()))
    return key
37115
def exact_search_request_hash(type, value)
      # turn it into an array if it's not one already
      values = Array(value)

      hash = {
          "PartnershipId" => Defaults.partnership_id,
          "ExactSearch" => []
      }

      values.each do |value|
        hash["ExactSearch"] << {
            "Type" => type.to_s.upcase,
            "Value" => value
        }
      end
    
      return hash
    end
493188
def search_hash(self, searchterm):
        
        return self.__search(type_attribute=self.__misphashtypes(), value=searchterm)
462452
def awesome_hash(h)
      return "{}" if h == {}

      keys = @options[:sort_keys] ? h.keys.sort { |a, b| a.to_s <=> b.to_s } : h.keys
      data = keys.map do |key|
        plain_single_line do
          [ @inspector.awesome(key), h[key] ]
        end
      end
      
      width = data.map { |key, | key.size }.max || 0
      width += @indentation if @options[:indent] > 0
      
      data = data.map do |key, value|
        indented do
          align(key, width) + colorize(" => ", :hash) + @inspector.awesome(value)
        end
      end

      data = limited(data, width, :hash => true) if should_be_limited?
      if @options[:multiline]
        "{\n" + data.join(",\n") + "\n#{outdent}}"
      else
        "{ #{data.join(', ')} }"
      end
    end
93022
def [](index)
      return @hash[index] if @hash&.has_key?(index)

      begin
        value = __getobj__[index]
        return value if @hash.nil?
        wrap_value = __wrap__(value)
        @hash[index] = wrap_value if wrap_value
        wrap_value || value
      end
    end
1030576
def fetch(key, type, default = nil)
			if (real_hash.has_key?(key))
				value = real_hash[key]

				# if type is not an array, but value is, flatten it.
				if (type != Array && !type.kind_of?(Array) && value.kind_of?(Array))
					value = value[0]
				end

				real = type.from_user_input(value)
				if (real != nil)
					return real
				end
			end
			return default
		end
561832
def method_missing(key, *args, &block)
      if key.to_s =~ /\A(.+)=\z/
        self[$1] = args.first
        return args.first
      end
      if key.to_s =~ /\A(.+)\?\z/
        return !!self[$1]
      end
      return self[key]  if has_key?(key)
      nil
    end
1279023
def each_pair(type, default = nil)
			real_hash.each_key() { |key|
				value = fetch(key, type, default)
				if (!value.nil?)
					yield(key, value)
				end
			}
		end
369029
def missing_hash_entries_as_string(the_hash, *keys)
    if keys.size == 1 && keys.first.is_a?(Array)
      keys = keys.first
    end
    missing_keys = missing_hash_entries(the_hash, *keys)
    missing_keys.empty? ? nil : missing_keys.inspect
  end
1275412
def get_keys_for(self, value):
        
        if callable(value):
            return value(self)
        hash_value = self.get_hash_for(value)
        return self._index[hash_value][:]
1015466
def hash_of(*keys)
      keys.each.with_object({}){|k,h| h[k] = send(k) }
    end
1217177
def keys
      if :hash == self.type
        self.children.map { |child| child.children[0] }
      else
        raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.debug_info}"
      end
    end
366495
def hashkey(*args, **kwargs):
    """"""

    if kwargs:
        return _HashedTuple(args + sum(sorted(kwargs.items()), _kwmark))
    else:
        return _HashedTuple(args)
1157744
def to_hash
      serialized_attributes = attributes.dup

      self.class.expandable_attributes.each_pair.select do |attribute_name, expanded_class|
        if expanded_class === attributes[attribute_name]
          serialized_attributes[attribute_name] = serialized_attributes[attribute_name].id
        end
      end

      serialized_attributes
    end
61131
def method_missing meth, *args
      meth_s = meth.to_s
      if meth_s =~ /=$/ and args.length == 1
        key = meth_s.sub(/=$/,'').camelcase
        if @data and @data.key? key
          @data[key] = args[0]
        else
          super meth, *args
        end
      else
        key = meth_s.camelcase
        if @data and @data.key? key
          @data[key]
        else
          super meth, *args
        end
      end
    end
314950
def filter_keys(snapshot)
      return unless snapshot.is_a? Hash
      snapshot.select {|k,v| FILTER_KEYS.include? k.to_s}
    end