Class: Moltrio::Config::SingleFileAdapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/moltrio/config/adapters/single_file_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Adapter

#[], #[]=, #available_namespaces, #fetch, #fetch_all, #has_key?, #on_namespace, #slice

Constructor Details

#initialize(config, path, must_exist: false) ⇒ SingleFileAdapter

Returns a new instance of SingleFileAdapter.



13
14
15
16
17
18
19
# File 'lib/moltrio/config/adapters/single_file_adapter.rb', line 13

def initialize(config, path, must_exist: false)
  @path = path

  if must_exist && !Pathname(path).file?
    raise "File '#{path}' doesn't exist!"
  end
end

Instance Attribute Details

#must_existObject (readonly)

Returns the value of attribute must_exist.



12
13
14
# File 'lib/moltrio/config/adapters/single_file_adapter.rb', line 12

def must_exist
  @must_exist
end

Instance Method Details

#missing_namespace?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/moltrio/config/adapters/single_file_adapter.rb', line 21

def missing_namespace?
  false
end