Class: Completely::Config
- Inherits:
-
Object
- Object
- Completely::Config
- Defined in:
- lib/completely/config.rb
Class Method Summary collapse
- .build(config) ⇒ Object
- .load(path) ⇒ Object
- .parse(str) ⇒ Object
- .pattern_config?(config) ⇒ Boolean
- .read(io) ⇒ Object
Class Method Details
.build(config) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/completely/config.rb', line 13 def build(config) if pattern_config? config PatternConfig.new config else FlatConfig.new config end end |
.load(path) ⇒ Object
10 |
# File 'lib/completely/config.rb', line 10 def load(path) = parse(File.read(path)) |
.parse(str) ⇒ Object
4 5 6 7 8 |
# File 'lib/completely/config.rb', line 4 def parse(str) build YAML.load(str, aliases: true) rescue Psych::Exception => e raise ParseError, "Invalid YAML: #{e.}" end |
.pattern_config?(config) ⇒ Boolean
21 22 23 |
# File 'lib/completely/config.rb', line 21 def pattern_config?(config) config.is_a?(Hash) && config.has_key?('patterns') end |
.read(io) ⇒ Object
11 |
# File 'lib/completely/config.rb', line 11 def read(io) = parse(io.read) |