Class: CC::CLI::Config
- Inherits:
-
Object
- Object
- CC::CLI::Config
- Defined in:
- lib/cc/cli/config.rb
Instance Method Summary collapse
- #add_engine(engine_name, engine_config) ⇒ Object
- #add_exclude_paths(paths) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
5 6 7 8 9 10 |
# File 'lib/cc/cli/config.rb', line 5 def initialize @config = { "engines" => {}, "ratings" => { "paths" => [] } } end |
Instance Method Details
#add_engine(engine_name, engine_config) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/cc/cli/config.rb', line 12 def add_engine(engine_name, engine_config) config["engines"][engine_name] = { "enabled" => true } if engine_config["default_config"].present? config["engines"][engine_name]["config"] = engine_config["default_config"] end config["ratings"]["paths"] |= engine_config["default_ratings_paths"] end |
#add_exclude_paths(paths) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cc/cli/config.rb', line 22 def add_exclude_paths(paths) config["exclude_paths"] ||= [] config["exclude_paths"] += paths.map do |path| if path.ends_with?("/") "#{path}**/*" else path end end end |