Class: Itools::SizeResult
- Inherits:
-
Object
- Object
- Itools::SizeResult
- Defined in:
- lib/itools/link_map.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#file_serial_numers ⇒ Object
Returns the value of attribute file_serial_numers.
-
#folder_name ⇒ Object
Returns the value of attribute folder_name.
-
#size ⇒ Object
Returns the value of attribute size.
-
#space_count ⇒ Object
Returns the value of attribute space_count.
Class Method Summary collapse
-
.getSaveFileName(path_para) ⇒ Object
获取结果文件保存到目录.
-
.handleSize(size) ⇒ Object
size字符化.
Instance Method Summary collapse
-
#initialize ⇒ SizeResult
constructor
A new instance of SizeResult.
Constructor Details
#initialize ⇒ SizeResult
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_name ⇒ Object
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_numers ⇒ Object
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_name ⇒ Object
Returns the value of attribute folder_name.
342 343 344 |
# File 'lib/itools/link_map.rb', line 342 def folder_name @folder_name end |
#size ⇒ Object
Returns the value of attribute size.
342 343 344 |
# File 'lib/itools/link_map.rb', line 342 def size @size end |
#space_count ⇒ Object
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 |