Class: Whisperer::Config

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

Overview

This config class is used only for Rake tasks. The puspose of it is to allow third users to defile options in Yaml file for generating cassettes and then it will be picked up while generating cassettes.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load(file_name = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/whisperer/config.rb', line 17

def self.load(file_name = nil)
  raw_config = {}

  if file_name && File.exists?(file_name)
    raw_config = YAML.load(File.read(file_name)) || {}
  end

  config = new(raw_config)

  VCR.configure do |c|
    c.cassette_library_dir = config.generate_to
  end

  config
end

Instance Method Details

#to_ymlObject

Returns yaml record with configuration options.



34
35
36
37
38
# File 'lib/whisperer/config.rb', line 34

def to_yml
  "generate_to:       '#{generate_to}'\n" <<
  "builders_matcher:  '#{builders_matcher}'\n" <<
  "factories_matcher: '#{factories_matcher}'"
end