Class: Dip::Config::ConfigFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/dip/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(work_dir, override: false) ⇒ ConfigFinder

Returns a new instance of ConfigFinder.



32
33
34
35
36
37
38
39
40
# File 'lib/dip/config.rb', line 32

def initialize(work_dir, override: false)
  @override = override

  @file_path = if ENV["DIP_FILE"]
    Pathname.new(prepared_name(ENV["DIP_FILE"]))
  else
    find(Pathname.new(work_dir))
  end
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



30
31
32
# File 'lib/dip/config.rb', line 30

def file_path
  @file_path
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/dip/config.rb', line 42

def exist?
  file_path&.exist?
end

#modules_dirObject



46
47
48
# File 'lib/dip/config.rb', line 46

def modules_dir
  file_path.dirname / ".dip"
end