module FlightConfig::Core::ClassMethods
Public Instance Methods
_path(*args)
click to toggle source
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
# 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)
click to toggle source
*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
# 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)
click to toggle source
# 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