Class: MrMurano::Config::ConfigFile
- Inherits:
-
Struct
- Object
- Struct
- MrMurano::Config::ConfigFile
- Defined in:
- lib/MrMurano/Config.rb
Overview
internal transient this-run-only things (also -c options)
specified from --configfile
env from ENV['MR_CONFIGFILE']
project .mrmuranorc at project dir
user .mrmuranorc at $HOME
system .mrmuranorc at /etc
defaults Internal hardcoded defaults
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#kind ⇒ Object
Returns the value of attribute kind.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data
15 16 17 |
# File 'lib/MrMurano/Config.rb', line 15 def data @data end |
#kind ⇒ Object
Returns the value of attribute kind
15 16 17 |
# File 'lib/MrMurano/Config.rb', line 15 def kind @kind end |
#path ⇒ Object
Returns the value of attribute path
15 16 17 |
# File 'lib/MrMurano/Config.rb', line 15 def path @path end |
Instance Method Details
#load ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/MrMurano/Config.rb', line 16 def load() return if kind == :internal return if kind == :defaults self[:path] = Pathname.new(path) unless path.kind_of? Pathname self[:data] = IniFile.new(:filename=>path.to_s) if self[:data].nil? self[:data].restore end |
#write ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/MrMurano/Config.rb', line 24 def write() return if kind == :internal return if kind == :defaults self[:path] = Pathname.new(path) unless path.kind_of? Pathname self[:data] = IniFile.new(:filename=>path.to_s) if self[:data].nil? self[:data].save path.chmod(0600) end |