Class: Frett::Config

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

Class Method Summary collapse

Class Method Details

.config_pathObject



33
34
35
# File 'lib/frett/config.rb', line 33

def config_path
  File.join(File.expand_path(self.working_dir), '.frett.yml')
end

.default_optionsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/frett/config.rb', line 4

def default_options
  {
    :exclude => "^tags$|log\/|tmp\/",
    :num_docs => 100000,
    :directory => ".frett",
    :log => true,
    :consider_mtime => true,
    :service_name => "frett_service",
    :search => {
      :use_wildcard => false,
      :escape => true,
      :use_or => false
    }
  }
end

.index_pathObject



25
26
27
# File 'lib/frett/config.rb', line 25

def index_path
  File.join(File.expand_path(self.working_dir), self.directory)
end

.load_config(working_dir) ⇒ Object



20
21
22
23
# File 'lib/frett/config.rb', line 20

def load_config(working_dir)
  @options = default_options.merge(:working_dir => working_dir)
  @options.merge!(YAML.load(File.read(self.config_path))) if File.exists?(self.config_path)
end

.method_missing(meth, *args, &block) ⇒ Object



37
38
39
# File 'lib/frett/config.rb', line 37

def method_missing(meth, *args, &block)
  @options[meth]
end

.mtime_pathObject



29
30
31
# File 'lib/frett/config.rb', line 29

def mtime_path
  File.join(index_path, 'mtime')
end