Class: Docker::Path

Inherits:
Object
  • Object
show all
Defined in:
lib/docker/path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Path

Returns a new instance of Path.



5
6
7
8
9
# File 'lib/docker/path.rb', line 5

def initialize(path)
  raise "Bad Path: Directory Not Found" unless Dir.exist?(path)
  @path = File.expand_path(path)
  @name = @path.sub(/\/$/, '').sub(/.+\//, '')
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/docker/path.rb', line 4

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/docker/path.rb', line 4

def path
  @path
end

Instance Method Details

#to_dpathObject



15
16
17
# File 'lib/docker/path.rb', line 15

def to_dpath
  self
end

#to_sObject



11
12
13
# File 'lib/docker/path.rb', line 11

def to_s
  @path
end