Module: FlightConfig::Reader::ClassMethods

Includes:
Core::ClassMethods
Included in:
Indexable::ClassMethods, Updater::ClassMethods
Defined in:
lib/flight_config/reader.rb

Instance Method Summary collapse

Methods included from Core::ClassMethods

#_path, #allow_missing_read, #data_core

Instance Method Details

#new!(*a, **h) ⇒ Object



57
58
59
60
61
# File 'lib/flight_config/reader.rb', line 57

def new!(*a, **h)
  new(*a, **h).tap do |config|
    yield config if block_given?
  end
end

#read(*a, registry: nil) ⇒ Object Also known as: load



63
64
65
# File 'lib/flight_config/reader.rb', line 63

def read(*a, registry: nil)
  (registry || Registry.new).read(self, *a)
end

#read_or_new(*a) ⇒ Object



68
69
70
# File 'lib/flight_config/reader.rb', line 68

def read_or_new(*a)
  File.exists?(_path(*a)) ? read(*a) : new(*a)
end