Class: Leftovers::Config
- Inherits:
-
Object
- Object
- Leftovers::Config
- Defined in:
- lib/leftovers/config.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #to_sym)
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #dynamic ⇒ Object
- #exclude_paths ⇒ Object
- #gems ⇒ Object
- #include_paths ⇒ Object
-
#initialize(name, path: nil, content: nil) ⇒ Config
constructor
A new instance of Config.
- #keep ⇒ Object
- #precompile ⇒ Object
- #requires ⇒ Object
- #test_only ⇒ Object
- #test_paths ⇒ Object
Constructor Details
#initialize(name, path: nil, content: nil) ⇒ Config
Returns a new instance of Config.
19 20 21 22 23 |
# File 'lib/leftovers/config.rb', line 19 def initialize(name, path: nil, content: nil) @name = name.to_sym @path = path @content = content end |
Instance Attribute Details
#name ⇒ Object (readonly) Also known as: to_sym
Returns the value of attribute name.
5 6 7 |
# File 'lib/leftovers/config.rb', line 5 def name @name end |
Class Method Details
.[](name_or_config) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/leftovers/config.rb', line 8 def self.[](name_or_config) return name_or_config if name_or_config.is_a?(self) @loaded_configs ||= {} @loaded_configs[name_or_config] ||= new(name_or_config) end |
.reset ⇒ Object
15 16 17 |
# File 'lib/leftovers/config.rb', line 15 def self.reset @loaded_configs = {} end |
Instance Method Details
#dynamic ⇒ Object
45 46 47 |
# File 'lib/leftovers/config.rb', line 45 def dynamic @dynamic ||= ProcessorBuilders::Dynamic.build(yaml[:dynamic]) end |
#exclude_paths ⇒ Object
29 30 31 |
# File 'lib/leftovers/config.rb', line 29 def exclude_paths @exclude_paths ||= Array(yaml[:exclude_paths]) end |
#gems ⇒ Object
25 26 27 |
# File 'lib/leftovers/config.rb', line 25 def gems @gems ||= Array(yaml[:gems]).map(&:to_sym) end |
#include_paths ⇒ Object
33 34 35 |
# File 'lib/leftovers/config.rb', line 33 def include_paths @include_paths ||= Array(yaml[:include_paths]) end |
#keep ⇒ Object
49 50 51 |
# File 'lib/leftovers/config.rb', line 49 def keep @keep ||= MatcherBuilders::Node.build(yaml[:keep]) end |
#precompile ⇒ Object
41 42 43 |
# File 'lib/leftovers/config.rb', line 41 def precompile @precompile ||= ::Leftovers.wrap_array(yaml[:precompile]) end |
#requires ⇒ Object
57 58 59 |
# File 'lib/leftovers/config.rb', line 57 def requires @requires ||= Array(yaml[:requires]) end |
#test_only ⇒ Object
53 54 55 |
# File 'lib/leftovers/config.rb', line 53 def test_only @test_only ||= MatcherBuilders::Node.build(yaml[:test_only]) end |
#test_paths ⇒ Object
37 38 39 |
# File 'lib/leftovers/config.rb', line 37 def test_paths @test_paths ||= Array(yaml[:test_paths]) end |