Class: Escort::Setup::Configuration::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/escort/setup/configuration/loader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(setup, auto_options) ⇒ Loader

Returns a new instance of Loader.



7
8
9
10
# File 'lib/escort/setup/configuration/loader.rb', line 7

def initialize(setup, auto_options)
  @setup = setup
  @auto_options = auto_options
end

Instance Attribute Details

#auto_optionsObject (readonly)

Returns the value of attribute auto_options.



5
6
7
# File 'lib/escort/setup/configuration/loader.rb', line 5

def auto_options
  @auto_options
end

#setupObject (readonly)

Returns the value of attribute setup.



5
6
7
# File 'lib/escort/setup/configuration/loader.rb', line 5

def setup
  @setup
end

Instance Method Details

#configurationObject



12
13
14
15
16
17
18
19
# File 'lib/escort/setup/configuration/loader.rb', line 12

def configuration
  if setup.has_config_file?
    Writer.new(config_path, Generator.new(setup).default_data).write if setup.config_file_autocreatable?
    Reader.new(config_path).read
  else
    Instance.blank
  end
end

#default_config_pathObject



21
22
23
# File 'lib/escort/setup/configuration/loader.rb', line 21

def default_config_path
  @default_config_path ||= (config_filename ? File.join(File.expand_path(ENV["HOME"]), config_filename) : nil)
end