Class: WatchTower::FileTree

Inherits:
Object
  • Object
show all
Defined in:
lib/watch_tower/file_tree.rb

Overview

This class is used by the server to provided a FileTree representation of the files and their elapsed time

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_path, files) ⇒ FileTree

Initialize

Parameters:

  • base_path: (String)

    The base path of all files, usually the project’s path

  • files: (Array)

    The files and their elapsed time The Array elements should be Hashes with two required keys :path and :elapsed_time



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

def initialize(base_path, files)
  # Init with args
  @base_path = base_path
  @all_files = remove_base_path_from_files(@base_path, files)
  # Init with defaults
  @elapsed_time = 0
  @files = Array.new
  @nested_tree = Hash.new
  # Process the tree
  process
end

Instance Attribute Details

#base_pathObject (readonly)

Returns the value of attribute base_path.



8
9
10
# File 'lib/watch_tower/file_tree.rb', line 8

def base_path
  @base_path
end

#elapsed_timeObject (readonly)

Returns the value of attribute elapsed_time.



8
9
10
# File 'lib/watch_tower/file_tree.rb', line 8

def elapsed_time
  @elapsed_time
end

#filesObject (readonly)

Returns the value of attribute files.



8
9
10
# File 'lib/watch_tower/file_tree.rb', line 8

def files
  @files
end

#nested_treeObject (readonly)

Returns the value of attribute nested_tree.



8
9
10
# File 'lib/watch_tower/file_tree.rb', line 8

def nested_tree
  @nested_tree
end