class RubybenchRunner::Configurations
Constants
- CONFIG_PATH
- CONFIG_VERSION
- DEFAULTS
- MYSQL_MAPPING
Public Class Methods
new(mysql_map: false)
click to toggle source
# File lib/rubybench_runner/configurations.rb, line 26 def initialize(mysql_map: false) @mysql_map = mysql_map if !File.exists?(CONFIG_PATH) File.write(CONFIG_PATH, YAML.dump(DEFAULTS)) end end
Public Instance Methods
[](key)
click to toggle source
# File lib/rubybench_runner/configurations.rb, line 33 def [](key) key = key.to_s result = config key.split(".").each do |k| result = result[k] || result[k.to_sym] end result end
config()
click to toggle source
# File lib/rubybench_runner/configurations.rb, line 42 def config content = File.read(CONFIG_PATH) if content != @content @content = content @parsed = YAML.load(@content) if @mysql_map MYSQL_MAPPING.each do |old, new| next if !@parsed[:mysql2].key?(old) val = @parsed[:mysql2][old] @parsed[:mysql2][new] = val @parsed[:mysql2].delete(old) end end end @parsed end
config_changed?()
click to toggle source
# File lib/rubybench_runner/configurations.rb, line 59 def config_changed? File.read(CONFIG_PATH) != YAML.dump(DEFAULTS) end