Class: FileTreeProfiler::Export::CSV

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile, filename) ⇒ CSV

Returns a new instance of CSV.



7
8
9
10
11
12
13
# File 'lib/file_tree_profiler/export/csv.rb', line 7

def initialize(profile, filename)
  @profile = profile
  @filename = filename
  ::CSV.open("#{filename}.csv", "wb") do |csv|
    profile csv, profile.root
  end
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



6
7
8
# File 'lib/file_tree_profiler/export/csv.rb', line 6

def filename
  @filename
end

#profile(csv, dir_file) ⇒ Object (readonly)

Returns the value of attribute profile.



6
7
8
# File 'lib/file_tree_profiler/export/csv.rb', line 6

def profile
  @profile
end

Instance Method Details

#write_line(csv, file) ⇒ Object



15
16
17
# File 'lib/file_tree_profiler/export/csv.rb', line 15

def write_line csv, file
  csv << [file.class, file.path, file.relative_path, file.name, file.checksum, file.empty?, file.size]
end