Class: FileTreeProfiler::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/file_tree_profiler/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(full_path) ⇒ Profile

Returns a new instance of Profile.

Parameters:

  • full_path (String)

    of the directory

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
# File 'lib/file_tree_profiler/profile.rb', line 6

def initialize full_path
  raise ArgumentError, "Not a directory - #{full_path}" \
    unless ::File.directory?(full_path)
  dir_name = ::File.basename(full_path)
  @path = full_path.gsub(::File.join('', dir_name), '')
  @root = DirFile.new(self, dir_name)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/file_tree_profiler/profile.rb', line 3

def path
  @path
end

#rootObject (readonly)

Returns the value of attribute root.



3
4
5
# File 'lib/file_tree_profiler/profile.rb', line 3

def root
  @root
end

Instance Method Details

#checksumObject



18
19
20
# File 'lib/file_tree_profiler/profile.rb', line 18

def checksum
  root.checksum
end

#sizeObject



14
15
16
# File 'lib/file_tree_profiler/profile.rb', line 14

def size
  root.size
end