Class: MagicQuery::Config::RulesLoader
- Inherits:
-
Object
- Object
- MagicQuery::Config::RulesLoader
- Defined in:
- lib/magic_query/config/rules_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path) ⇒ RulesLoader
constructor
A new instance of RulesLoader.
- #load ⇒ Object
Constructor Details
#initialize(path) ⇒ RulesLoader
Returns a new instance of RulesLoader.
12 13 14 |
# File 'lib/magic_query/config/rules_loader.rb', line 12 def initialize(path) @path = path end |
Class Method Details
.load(path) ⇒ Object
8 9 10 |
# File 'lib/magic_query/config/rules_loader.rb', line 8 def self.load(path) new(path).load end |
Instance Method Details
#load ⇒ Object
16 17 18 19 20 21 |
# File 'lib/magic_query/config/rules_loader.rb', line 16 def load return {} unless @path && File.exist?(@path) yaml_data = YAML.safe_load_file(@path) || {} normalize_rules(yaml_data) end |