Class: Madness::Settings

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/madness/settings.rb

Overview

Handle teh configuration options Each configuration option has three sources

  1. The default value

  2. The setting as provided in the ./.madness.yml

  3. Any override provided later (for example, by the CommandLine class)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSettings

Returns a new instance of Settings.



15
16
17
# File 'lib/madness/settings.rb', line 15

def initialize
  reset
end

Instance Attribute Details

#autoh1Object

Returns the value of attribute autoh1.



12
13
14
# File 'lib/madness/settings.rb', line 12

def autoh1
  @autoh1
end

#bindObject

Returns the value of attribute bind.



12
13
14
# File 'lib/madness/settings.rb', line 12

def bind
  @bind
end

#developmentObject

Returns the value of attribute development.



12
13
14
# File 'lib/madness/settings.rb', line 12

def development
  @development
end

#highlighterObject

Returns the value of attribute highlighter.



12
13
14
# File 'lib/madness/settings.rb', line 12

def highlighter
  @highlighter
end

#indexObject

Returns the value of attribute index.



12
13
14
# File 'lib/madness/settings.rb', line 12

def index
  @index
end

#line_numbersObject

Returns the value of attribute line_numbers.



12
13
14
# File 'lib/madness/settings.rb', line 12

def line_numbers
  @line_numbers
end

#pathObject

Returns the value of attribute path.



12
13
14
# File 'lib/madness/settings.rb', line 12

def path
  @path
end

#portObject

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

Returns:

  • (Boolean)


27
28
29
# File 'lib/madness/settings.rb', line 27

def file_exist?
  File.exist? filename
end

#filenameObject



31
32
33
# File 'lib/madness/settings.rb', line 31

def filename
  '.madness.yml'
end

#resetObject

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