mirror of
https://github.com/onyx-and-iris/voicemeeter-rb.git
synced 2024-11-21 17:30:49 +00:00
no need to pass loader reference to FileReader
This commit is contained in:
parent
fdfadaafac
commit
bb62f01b11
@ -51,8 +51,7 @@ module Voicemeeter
|
||||
class FileReader
|
||||
include Logging
|
||||
|
||||
def initialize(loader, kind)
|
||||
@loader = loader
|
||||
def initialize(kind)
|
||||
@configpaths = [
|
||||
Pathname.getwd.join("configs", kind.name.to_s),
|
||||
Pathname.new(Dir.home).join(".config", "voicemeeter-rb", kind.name.to_s),
|
||||
@ -90,13 +89,22 @@ module Voicemeeter
|
||||
@configs = Hash.new do |hash, key|
|
||||
raise Errors::VMError.new "unknown config #{key}. known configs: #{hash.keys}"
|
||||
end
|
||||
@filereader = FileReader.new(self, kind)
|
||||
@filereader = FileReader.new(kind)
|
||||
end
|
||||
|
||||
def to_s
|
||||
"Loader #{@kind}"
|
||||
end
|
||||
|
||||
def run
|
||||
logger.debug "Running #{self}"
|
||||
configs[:reset] = TOMLStrBuilder.run(@kind)
|
||||
@filereader.each do |identifier, data|
|
||||
register(identifier, data)
|
||||
end
|
||||
self
|
||||
end
|
||||
|
||||
private def register(identifier, data)
|
||||
if configs.key? identifier
|
||||
logger.debug "config with name '#{identifier}' already in memory, skipping..."
|
||||
@ -106,15 +114,6 @@ module Voicemeeter
|
||||
configs[identifier] = data
|
||||
logger.info "#{@kind.name}/#{identifier} loaded into memory"
|
||||
end
|
||||
|
||||
def run
|
||||
logger.debug "Running #{self}"
|
||||
configs[:reset] = TOMLStrBuilder.run(@kind)
|
||||
@filereader.each do |identifier, data|
|
||||
register(identifier, data)
|
||||
end
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
def get(kind_id)
|
||||
|
Loading…
Reference in New Issue
Block a user