Class: Madness::Settings
- Inherits:
-
Object
- Object
- Madness::Settings
- Includes:
- Singleton
- Defined in:
- lib/madness/settings.rb
Overview
Handle teh configuration options Each configuration option has three sources
-
The default value
-
The setting as provided in the ./.madness.yml
-
Any override provided later (for example, by the CommandLine class)
Instance Attribute Summary collapse
-
#autoh1 ⇒ Object
Returns the value of attribute autoh1.
-
#bind ⇒ Object
Returns the value of attribute bind.
-
#development ⇒ Object
Returns the value of attribute development.
-
#highlighter ⇒ Object
Returns the value of attribute highlighter.
-
#index ⇒ Object
Returns the value of attribute index.
-
#line_numbers ⇒ Object
Returns the value of attribute line_numbers.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
- #file_exist? ⇒ Boolean
- #filename ⇒ Object
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
-
#reset ⇒ Object
Force reload of the config file, set defaults, and then read from file.
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
15 16 17 |
# File 'lib/madness/settings.rb', line 15 def initialize reset end |
Instance Attribute Details
#autoh1 ⇒ Object
Returns the value of attribute autoh1.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def autoh1 @autoh1 end |
#bind ⇒ Object
Returns the value of attribute bind.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def bind @bind end |
#development ⇒ Object
Returns the value of attribute development.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def development @development end |
#highlighter ⇒ Object
Returns the value of attribute highlighter.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def highlighter @highlighter end |
#index ⇒ Object
Returns the value of attribute index.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def index @index end |
#line_numbers ⇒ Object
Returns the value of attribute line_numbers.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def line_numbers @line_numbers end |
#path ⇒ Object
Returns the value of attribute path.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
12 13 14 |
# File 'lib/madness/settings.rb', line 12 def port @port end |
Instance Method Details
#file_exist? ⇒ Boolean
27 28 29 |
# File 'lib/madness/settings.rb', line 27 def file_exist? File.exist? filename end |
#filename ⇒ Object
31 32 33 |
# File 'lib/madness/settings.rb', line 31 def filename '.madness.yml' end |
#reset ⇒ Object
Force reload of the config file, set defaults, and then read from file.
21 22 23 24 25 |
# File 'lib/madness/settings.rb', line 21 def reset @config_file = nil set_defaults load_from_file if config_file end |