Class: Voicemeeter::Configs::Loader

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/voicemeeter/configs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Logging

#logger

Constructor Details

#initialize(kind) ⇒ Loader

Returns a new instance of Loader.



78
79
80
81
82
83
84
# File 'lib/voicemeeter/configs.rb', line 78

def initialize(kind)
  @kind = kind
  @configs = Hash.new do |hash, key|
    raise Errors::VMError.new "unknown config '#{key}'. known configs: #{hash.keys}"
  end
  @filereader = FileReader.new(kind)
end

Instance Attribute Details

#configsObject (readonly)

Returns the value of attribute configs.



76
77
78
# File 'lib/voicemeeter/configs.rb', line 76

def configs
  @configs
end

Instance Method Details

#runObject



90
91
92
93
94
95
# File 'lib/voicemeeter/configs.rb', line 90

def run
  logger.debug "Running #{self}"
  configs[:reset] = TOMLConfBuilder.run(@kind)
  @filereader.each(&method(:register))
  self
end

#to_sObject



86
87
88
# File 'lib/voicemeeter/configs.rb', line 86

def to_s
  "Loader #{@kind}"
end