Method: Codependency::Path#<<

Defined in:
lib/codependency/path.rb

#<<(str) ⇒ Object

Appends a path to this path set. If the path exists, it will be expanded. Raises Errno::ENOENT if the path does not exist. Raises Errno::ENOTDIR if the path is not a directory.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/codependency/path.rb', line 16

def <<( str )
  path = Pathname( str )

  case
  when !path.exist?
    raise Errno::ENOENT, path.to_path
  when !path.directory?
    raise Errno::ENOTDIR, path.to_path
  else
    super path.expand_path
  end
end