Class: Hone::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/hone/config.rb

Constant Summary collapse

CONFIG_FILE =
".hone/config.yml"
DEFAULTS =
{
  harness: {
    warmup_iterations: 10,
    profile_iterations: 100,
    path: ".hone/harness.rb"
  },
  profilers: {
    cpu: "auto",
    memory: false
  },
  output: {
    dir: "tmp/hone"
  },
  analysis: {
    rails: false,
    show_cold: false,
    top: nil
  }
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(path = CONFIG_FILE) ⇒ Config

Returns a new instance of Config.



29
30
31
32
# File 'lib/hone/config.rb', line 29

def initialize(path = CONFIG_FILE)
  @path = path
  @data = load_config
end

Instance Method Details

#[](key) ⇒ Object



50
51
52
# File 'lib/hone/config.rb', line 50

def [](key)
  @data[key.to_sym]
end

#analysisObject



46
47
48
# File 'lib/hone/config.rb', line 46

def analysis
  @data[:analysis]
end

#exist?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/hone/config.rb', line 54

def exist?
  File.exist?(@path)
end

#harnessObject



34
35
36
# File 'lib/hone/config.rb', line 34

def harness
  @data[:harness]
end

#outputObject



42
43
44
# File 'lib/hone/config.rb', line 42

def output
  @data[:output]
end

#profilersObject



38
39
40
# File 'lib/hone/config.rb', line 38

def profilers
  @data[:profilers]
end