class WebStat::Configure

Constants

DEFAULT_CONFIG_FILE_PATH

Public Class Methods

get() click to toggle source

Get yaml

# File lib/web_stat/configure.rb, line 8
def get
  if defined? Rails
    YAML.load(ERB.new(File.read(get_configure_path)).result)[Rails.env]
  else
    YAML.load(ERB.new(File.read(get_configure_path)).result)[ENV["ENV"] || "production"]
  end
end
get_configure_path() click to toggle source

Get configure path

# File lib/web_stat/configure.rb, line 17
def get_configure_path
  if File.exists?(get_custom_configure_path)
    get_custom_configure_path
  else
    get_default_configure_path
  end
end
get_custom_configure_path() click to toggle source

Get custom configure path

# File lib/web_stat/configure.rb, line 31
def 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_path() click to toggle source

Get default configure path

# File lib/web_stat/configure.rb, line 26
def get_default_configure_path
  File.join(File.expand_path("../", __FILE__), DEFAULT_CONFIG_FILE_PATH)
end