Class: CC::Config::YAMLAdapter

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

Constant Summary collapse

DEFAULT_PATH =
".codeclimate.yml".freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yaml = {}) ⇒ YAMLAdapter

Returns a new instance of YAMLAdapter.



12
13
14
15
16
# File 'lib/cc/config/yaml_adapter.rb', line 12

def initialize(yaml = {})
  @config = yaml || {}

  upconvert_legacy_yaml!
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/cc/config/yaml_adapter.rb', line 6

def config
  @config
end

Class Method Details

.load(path = DEFAULT_PATH) ⇒ Object



8
9
10
# File 'lib/cc/config/yaml_adapter.rb', line 8

def self.load(path = DEFAULT_PATH)
  new(::YAML.safe_load(File.read(path)))
end