Class: DuPretty::Prettier::DiskUsage

Inherits:
Object
  • Object
show all
Defined in:
lib/du_pretty/prettier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw, root, total: nil) ⇒ DiskUsage

Returns a new instance of DiskUsage.



49
50
51
52
53
54
55
# File 'lib/du_pretty/prettier.rb', line 49

def initialize(raw, root, total: nil)
  @raw = raw
  @root = root
  @kbyte = raw.split("\t").compact[0].to_i
  @path = raw.split("\t").compact[1]
  @total = total
end

Instance Attribute Details

#kbyteObject

Returns the value of attribute kbyte.



47
48
49
# File 'lib/du_pretty/prettier.rb', line 47

def kbyte
  @kbyte
end

#pathObject

Returns the value of attribute path.



47
48
49
# File 'lib/du_pretty/prettier.rb', line 47

def path
  @path
end

#rawObject

Returns the value of attribute raw.



47
48
49
# File 'lib/du_pretty/prettier.rb', line 47

def raw
  @raw
end

Instance Method Details

#prettyObject



57
58
59
# File 'lib/du_pretty/prettier.rb', line 57

def pretty
  pretty_byte + "\t." + relative_path
end

#tree_formatObject



61
62
63
# File 'lib/du_pretty/prettier.rb', line 61

def tree_format
  pretty_path + ' ' + pretty_byte
end