Class: Mucks::BaseConfig
- Inherits:
-
Object
- Object
- Mucks::BaseConfig
- Defined in:
- lib/mucks/mucks.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(path) ⇒ BaseConfig
constructor
A new instance of BaseConfig.
- #show_self ⇒ Object
- #stringify_elements_for(array) ⇒ Object
Constructor Details
#initialize(path) ⇒ BaseConfig
Returns a new instance of BaseConfig.
14 15 16 17 |
# File 'lib/mucks/mucks.rb', line 14 def initialize(path) @config = SystemIO.load_yaml(File.(path)) show_self if Config.verbose end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/mucks/mucks.rb', line 13 def config @config end |
Instance Method Details
#show_self ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mucks/mucks.rb', line 19 def show_self Output.wrap_with(self.class) do s = '' @config.each do |key, value| s += "#{key} => " if value.is_a?(Array) then s += stringify_elements_for(value) else s += "\n" s += " #{value}}\n" end end puts s end end |
#stringify_elements_for(array) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/mucks/mucks.rb', line 35 def stringify_elements_for(array) s = "[\n" array.each do |element| s += " #{element.inspect},\n" end s += "]\n" end |