Module: CaChing::Index::ClassMethods

Defined in:
lib/ca_ching/index.rb

Instance Method Summary collapse

Instance Method Details

#index(field_name, options = {}) ⇒ Object



8
9
10
11
# File 'lib/ca_ching/index.rb', line 8

def index(field_name, options={})
  raise CaChing::InvalidOptionError unless options.keys.inject(true) { |flag, key| flag && CaChing::Index::VALID_OPTIONS.include?(key) } 
  indexed_fields[field_name] = options
end

#indexed_fieldsObject



17
18
19
# File 'lib/ca_ching/index.rb', line 17

def indexed_fields
  @_indexed_fields ||= {}
end

#indexes?(field_name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/ca_ching/index.rb', line 13

def indexes?(field_name)
  indexed_fields.has_key?(field_name)
end