Class: Mwc::Config

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mwc/config.rb

Overview

The compile preferences

Constant Summary collapse

LOCK =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 0.3.0

Mutex.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path = Mwc.root.join('.mwcrc')) ⇒ Config

:nodoc:



26
27
28
29
30
# File 'lib/mwc/config.rb', line 26

def initialize(path = Mwc.root.join('.mwcrc'))
  @path = Pathname.new(path)
  @default = Environment.new
  load_config if exist?
end

Instance Attribute Details

#defaultObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.3.0



23
24
25
# File 'lib/mwc/config.rb', line 23

def default
  @default
end

Instance Method Details

#exist?TrueClass, FalseClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Check config file exists

Returns:

  • (TrueClass, FalseClass)

    exist or not

Since:

  • 0.1.0



38
39
40
# File 'lib/mwc/config.rb', line 38

def exist?
  @path.exist?
end

#reloadObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Reload config

Since:

  • 0.1.0



46
47
48
# File 'lib/mwc/config.rb', line 46

def reload
  Mwc.config = Mwc.root.join('.mwcrc')
end