Class: EacConfig::LoadPath

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_config/load_path.rb

Constant Summary collapse

ENTRY_PATH =
::EacConfig::EntryPath.assert(%w[load_path])
PATH_SEPARATOR =
':'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.paths_to_string(paths) ⇒ Object



12
13
14
# File 'lib/eac_config/load_path.rb', line 12

def paths_to_string(paths)
  paths.map(&:to_s).join(PATH_SEPARATOR)
end

.string_to_paths(string) ⇒ Object



16
17
18
# File 'lib/eac_config/load_path.rb', line 16

def string_to_paths(string)
  string.to_s.split(PATH_SEPARATOR)
end

Instance Method Details

#entryObject



23
24
25
# File 'lib/eac_config/load_path.rb', line 23

def entry
  node.self_entry(ENTRY_PATH)
end

#pathsArray<String>

Returns:

  • (Array<String>)


28
29
30
# File 'lib/eac_config/load_path.rb', line 28

def paths
  self.class.string_to_paths(entry.value)
end

#push(new_path) ⇒ Object



32
33
34
# File 'lib/eac_config/load_path.rb', line 32

def push(new_path)
  entry.value = self.class.paths_to_string(paths + [new_path])
end