Class: Xapor::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/xapor/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



6
7
8
9
# File 'lib/xapor/config.rb', line 6

def initialize
  @search_fields = []
  @store_fields = []
end

Instance Attribute Details

#directory_configObject (readonly)

Returns the value of attribute directory_config.



4
5
6
# File 'lib/xapor/config.rb', line 4

def directory_config
  @directory_config
end

#search_fieldsObject (readonly)

Returns the value of attribute search_fields.



2
3
4
# File 'lib/xapor/config.rb', line 2

def search_fields
  @search_fields
end

#store_fieldsObject (readonly)

Returns the value of attribute store_fields.



3
4
5
# File 'lib/xapor/config.rb', line 3

def store_fields
  @store_fields
end

Instance Method Details

#directory(path) ⇒ Object



18
19
20
# File 'lib/xapor/config.rb', line 18

def directory(path)
  @directory_config = path
end

#search(field, options = {}) ⇒ Object



11
12
13
14
15
16
# File 'lib/xapor/config.rb', line 11

def search(field, options = {})
  @search_fields << field
  if options[:store]
    @store_fields << field
  end
end

#xapian_fu_dbObject



22
23
24
25
26
27
# File 'lib/xapor/config.rb', line 22

def xapian_fu_db
  db_settings = {}
  db_settings[:dir] = @directory_config if @directory_config
  db_settings[:store] = @store_fields unless @store_fields.empty?
  return db_settings
end