Class: MetadataCop::ConfigLoader
- Inherits:
-
Object
- Object
- MetadataCop::ConfigLoader
- Defined in:
- lib/metadatacop/config_loader.rb
Constant Summary collapse
- METADATACOP_HOME =
File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
- DEFAULT_PATH =
File.join(METADATACOP_HOME, 'config', '%{type}', 'default.yml')
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #configuration ⇒ Object
- #cops ⇒ Object
-
#initialize(options = {}) ⇒ ConfigLoader
constructor
A new instance of ConfigLoader.
Constructor Details
#initialize(options = {}) ⇒ ConfigLoader
Returns a new instance of ConfigLoader.
8 9 10 |
# File 'lib/metadatacop/config_loader.rb', line 8 def initialize( = {}) = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/metadatacop/config_loader.rb', line 6 def end |
Instance Method Details
#configuration ⇒ Object
12 13 14 |
# File 'lib/metadatacop/config_loader.rb', line 12 def configuration @configuration ||= YAML.load_file(default_path) end |
#cops ⇒ Object
16 17 18 19 20 |
# File 'lib/metadatacop/config_loader.rb', line 16 def cops configuration.select(&method(:cop?)).select(&method(:enabled?)).map do |cop, | cop_class(cop).new() end end |