Class: FileInfo
Overview
An entity object where you can set all attributes no matter if (or where) the file exists. Next to a name and path it has further attributes such as a creation and a modification time and a size in bytes. New instances aren’t directories by default but you can set this flag, too.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ctime ⇒ Object
Returns the value of attribute ctime.
-
#mtime ⇒ Object
Returns the value of attribute mtime.
-
#size ⇒ Object
Returns the value of attribute size.
Attributes inherited from FileName
Instance Method Summary collapse
- #ctime_string ⇒ Object
- #directory! ⇒ Object
- #directory? ⇒ Boolean
-
#initialize(the_name, the_path = '') ⇒ FileInfo
constructor
A new instance of FileInfo.
- #mtime_string ⇒ Object
Methods inherited from FileName
#extension, #name_with_path, #name_without_extension, #path_sections, #set_path
Constructor Details
#initialize(the_name, the_path = '') ⇒ FileInfo
Returns a new instance of FileInfo.
98 99 100 101 102 |
# File 'lib/piggy-core/file_info.rb', line 98 def initialize(the_name, the_path = '') super(the_name, the_path) @size = 0 @is_directory = false end |
Instance Attribute Details
#ctime ⇒ Object
Returns the value of attribute ctime.
96 97 98 |
# File 'lib/piggy-core/file_info.rb', line 96 def ctime @ctime end |
#mtime ⇒ Object
Returns the value of attribute mtime.
96 97 98 |
# File 'lib/piggy-core/file_info.rb', line 96 def mtime @mtime end |
#size ⇒ Object
Returns the value of attribute size.
96 97 98 |
# File 'lib/piggy-core/file_info.rb', line 96 def size @size end |
Instance Method Details
#ctime_string ⇒ Object
116 117 118 |
# File 'lib/piggy-core/file_info.rb', line 116 def ctime_string time_string_for(ctime) end |
#directory! ⇒ Object
108 109 110 |
# File 'lib/piggy-core/file_info.rb', line 108 def directory! @is_directory = true end |
#directory? ⇒ Boolean
104 105 106 |
# File 'lib/piggy-core/file_info.rb', line 104 def directory? return @is_directory end |
#mtime_string ⇒ Object
112 113 114 |
# File 'lib/piggy-core/file_info.rb', line 112 def mtime_string time_string_for(mtime) end |