Class: Itools::SizeResult

Inherits:
Object
  • Object
show all
Defined in:
lib/itools/link_map.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSizeResult

Returns a new instance of SizeResult.



343
344
345
346
# File 'lib/itools/link_map.rb', line 343

def initialize
   @file_serial_numers = []
   @size = 0
end

Instance Attribute Details

#file_nameObject

Returns the value of attribute file_name.



342
343
344
# File 'lib/itools/link_map.rb', line 342

def file_name
  @file_name
end

#file_serial_numersObject

Returns the value of attribute file_serial_numers.



342
343
344
# File 'lib/itools/link_map.rb', line 342

def file_serial_numers
  @file_serial_numers
end

#folder_nameObject

Returns the value of attribute folder_name.



342
343
344
# File 'lib/itools/link_map.rb', line 342

def folder_name
  @folder_name
end

#sizeObject

Returns the value of attribute size.



342
343
344
# File 'lib/itools/link_map.rb', line 342

def size
  @size
end

#space_countObject

Returns the value of attribute space_count.



342
343
344
# File 'lib/itools/link_map.rb', line 342

def space_count
  @space_count
end

Class Method Details

.getSaveFileName(path_para) ⇒ Object

获取结果文件保存到目录



358
359
360
361
362
363
# File 'lib/itools/link_map.rb', line 358

def self.getSaveFileName(path_para)
   path = Pathname.new(path_para)
   # 要保存的地址
   save_file_path = path.dirname.to_s + "/" + "parse_" + path.basename.to_s + "_result(#{Time.new.strftime("%Y%m%d%H%M%S")}).txt"
   return save_file_path
end

.handleSize(size) ⇒ Object

size字符化



348
349
350
351
352
353
354
355
356
# File 'lib/itools/link_map.rb', line 348

def self.handleSize(size)
   if size > 1024 * 1024
      return format("%.2f",(size.to_f/(1024*1024))) + "MB"
   elsif size > 1024
      return format("%.2f",(size.to_f/1024)) + "KB"
   else
      return size.to_s + "B"
   end
end