Class: PointRb::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/pointrb/directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, base_dir = "") ⇒ Directory

Returns a new instance of Directory.



8
9
10
11
# File 'lib/pointrb/directory.rb', line 8

def initialize(path,base_dir="")
  @path = path
  @base_dir = base_dir
end

Instance Attribute Details

#base_dirObject

Returns the value of attribute base_dir.



6
7
8
# File 'lib/pointrb/directory.rb', line 6

def base_dir
  @base_dir
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/pointrb/directory.rb', line 6

def path
  @path
end

Instance Method Details

#createObject



21
22
23
# File 'lib/pointrb/directory.rb', line 21

def create
  FileUtils.mkdir_p full_path
end

#full_pathObject



13
14
15
16
17
18
19
# File 'lib/pointrb/directory.rb', line 13

def full_path
  if @path =~ /^\//
    @path
  else
    File.join(@base_dir, @path)
  end
end