Class: WebStat::Configure

Inherits:
Object
  • Object
show all
Defined in:
lib/web_stat/configure.rb

Constant Summary collapse

DEFAULT_CONFIG_FILE_PATH =
'config/web_stat.yml'

Class Method Summary collapse

Class Method Details

.getObject

Get yaml



7
8
9
# File 'lib/web_stat/configure.rb', line 7

def self.get
  YAML.load_file(self.get_configure_path)
end

.get_configure_pathObject

Get configure path



12
13
14
15
16
17
18
# File 'lib/web_stat/configure.rb', line 12

def self.get_configure_path
  if File.exists?(self.get_custom_configure_path)
    self.get_custom_configure_path
  else
    self.get_default_configure_path
  end
end

.get_custom_configure_pathObject

Get custom configure path



26
27
28
29
30
31
32
# File 'lib/web_stat/configure.rb', line 26

def self.get_custom_configure_path
  if defined? Rails
	File.join(Rails.root, DEFAULT_CONFIG_FILE_PATH)
  else
    File.join(Bundler.root, DEFAULT_CONFIG_FILE_PATH)
  end
end

.get_default_configure_pathObject

Get default configure path



21
22
23
# File 'lib/web_stat/configure.rb', line 21

def self.get_default_configure_path
  File.join(File.expand_path("../", __FILE__), DEFAULT_CONFIG_FILE_PATH)
end