Class: Pathname

Inherits:
Object show all
Defined in:
lib/docker/template/patches/pathname.rb

Overview

Copyright: 2015 Jordon Bedwell - Apache v2.0 License Encoding: utf-8

Instance Method Summary collapse

Instance Method Details

#all_childrenObject



35
36
37
# File 'lib/docker/template/patches/pathname.rb', line 35

def all_children
  glob "**/*"
end

#expanded_pathObject



19
20
21
22
23
# File 'lib/docker/template/patches/pathname.rb', line 19

def expanded_path
  @expanded_path ||= begin
    expand_path Dir.pwd
  end
end

#expanded_realpathObject



27
28
29
30
31
# File 'lib/docker/template/patches/pathname.rb', line 27

def expanded_realpath
  @expanded_real_path ||= begin
    expanded_path.realpath
  end
end

#glob(*args) ⇒ Object



41
42
43
44
45
# File 'lib/docker/template/patches/pathname.rb', line 41

def glob(*args)
  Dir.glob(join(*args)).map do |path|
    self.class.new(path)
  end
end

#in_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
# File 'lib/docker/template/patches/pathname.rb', line 6

def in_path?(path)
  path_str = path.is_a?(self.class) ? path.expanded_realpath.to_s : path.to_s
  expanded_realpath.to_s.start_with?(path_str)
end

#write(data) ⇒ Object



13
14
15
# File 'lib/docker/template/patches/pathname.rb', line 13

def write(data)
  File.write(to_s, data)
end