Class: Recot::Config
Constant Summary collapse
- CONFIG_YML =
'config.yml'.freeze
- KEY_THEME =
'theme'.freeze
- KEY_PROJECT_NAME =
'project_name'.freeze
- DEFAULT_THEME =
'white'.freeze
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#project_name ⇒ Object
Get project_name from config.yml.
-
#theme ⇒ Object
Get theme from config.yml.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 21 |
# File 'lib/recot/config.rb', line 15 def initialize # read config.yml file @config = nil if File.exist?("#{Dir.pwd}/#{CONFIG_YML}") @config = YAML.load_file("#{Dir.pwd}/#{CONFIG_YML}") end end |
Instance Method Details
#project_name ⇒ Object
Get project_name from config.yml.
Returns:
A project_name. If not set return empty.
39 40 41 42 43 44 45 |
# File 'lib/recot/config.rb', line 39 def project_name name = '' if @config && @config[KEY_PROJECT_NAME] name = @config[KEY_PROJECT_NAME] end name end |
#theme ⇒ Object
Get theme from config.yml.
Returns:
A theme of html. If not set return ‘white’.
27 28 29 30 31 32 33 |
# File 'lib/recot/config.rb', line 27 def theme th = DEFAULT_THEME if @config && @config[KEY_THEME] th = @config[KEY_THEME] end th end |