Module: FlightConfig::Core::ClassMethods
- Included in:
- Reader::ClassMethods
- Defined in:
- lib/flight_config/core.rb
Instance Method Summary collapse
-
#_path(*args) ⇒ Object
NOTE: The _path method acts as adaptation layer to the two ways the path could be defined: on the class or instance.
-
#allow_missing_read(fetch: false) ⇒ Object
*READ ME*: Hack Alart NOTE: Override this method in your class, and it should just work TODO: Eventually replace the _path method with this def path(*_args) raise NotImplementedError end.
- #data_core(klass = nil, &b) ⇒ Object
Instance Method Details
#_path(*args) ⇒ Object
NOTE: The _path method acts as adaptation layer to the two ways the path could be defined: on the class or instance. Moving forward, the path method should be defined on the class NOTE: DO NOT USE THIS METHOD PUBLICLY. Define a ‘path` method instead
86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/flight_config/core.rb', line 86 def _path(*args) if self.respond_to?(:path) self.path(*args) else msg = <<~WARN.gsub("\n", ' ').chomp FlightConfig Deprecation: #{self}.path is not defined. Falling back to the instance method WARN Log.warn msg $stderr.puts msg self.new(*args).path end end |
#allow_missing_read(fetch: false) ⇒ Object
*READ ME*: Hack Alart NOTE: Override this method in your class, and it should just work TODO: Eventually replace the _path method with this def path(*_args)
raise NotImplementedError
end
107 108 109 110 111 112 113 |
# File 'lib/flight_config/core.rb', line 107 def allow_missing_read(fetch: false) if fetch @allow_missing_read ||= false else @allow_missing_read = true end end |
#data_core(klass = nil, &b) ⇒ Object
115 116 117 118 119 120 121 |
# File 'lib/flight_config/core.rb', line 115 def data_core(klass = nil, &b) @data_core ||= -> do obj = (klass || TTY::Config).new b ? b.call(obj) : obj end @data_core.call end |