Module: Waxx::Conf
Overview
The global Waxx::Conf variable. ex: `Waxx::Conf['name']` or shortcut `Waxx['name']` Data is set in opt/env/config.yaml
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Internal class var for conf data.
Instance Method Summary collapse
-
#/(n) ⇒ Object
Get a Waxx variable.
-
#[](n) ⇒ Object
Get a Waxx variable.
-
#[]=(n, v) ⇒ Object
Set a conf variable.
-
#load_yaml(base = ENV['PWD'], env = "active") ⇒ Object
Load the yaml config file into the Waxx module Access variables with Waxx['var2'] or Waxx/:var1/:var2.
Instance Attribute Details
#data ⇒ Object (readonly)
Internal class var for conf data
24 25 26 |
# File 'waxx/conf.rb', line 24 def data @data end |
Instance Method Details
#/(n) ⇒ Object
Get a Waxx variable
49 50 51 |
# File 'waxx/conf.rb', line 49 def /(n) @data[n.to_s] || @data[n.to_sym] end |
#[]=(n, v) ⇒ Object
Set a conf variable
43 44 45 |
# File 'waxx/conf.rb', line 43 def []=(n, v) @data[n] = v end |
#load_yaml(base = ENV['PWD'], env = "active") ⇒ Object
Load the yaml config file into the Waxx module Access variables with Waxx['var2'] or Waxx/:var1/:var2
30 31 32 33 |
# File 'waxx/conf.rb', line 30 def load_yaml(base=ENV['PWD'], env="active") env = "dev" if env == "active" and not File.exist? "#{base}/opt/active" @data = ::YAML.load_file("#{base}/opt/#{env}/config.yaml") end |