Class: Makit::FileInfo
- Inherits:
-
Object
- Object
- Makit::FileInfo
- Defined in:
- lib/makit/fileinfo.rb
Overview
This class provide methods for working with the system Environment.
Instance Attribute Summary collapse
-
#mtime ⇒ Object
Returns the value of attribute mtime.
-
#name ⇒ Object
Returns the value of attribute name.
-
#size ⇒ Object
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, mtime:, size:) ⇒ FileInfo
constructor
A new instance of FileInfo.
Constructor Details
#initialize(name:, mtime:, size:) ⇒ FileInfo
Returns a new instance of FileInfo.
10 11 12 13 14 |
# File 'lib/makit/fileinfo.rb', line 10 def initialize(name:, mtime:, size:) @name = name @mtime = mtime @size = size end |
Instance Attribute Details
#mtime ⇒ Object
Returns the value of attribute mtime.
8 9 10 |
# File 'lib/makit/fileinfo.rb', line 8 def mtime @mtime end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/makit/fileinfo.rb', line 8 def name @name end |
#size ⇒ Object
Returns the value of attribute size.
8 9 10 |
# File 'lib/makit/fileinfo.rb', line 8 def size @size end |
Class Method Details
.get_file_infos(filenames) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/makit/fileinfo.rb', line 16 def self.get_file_infos(filenames) filenames.map do |filename| FileInfo.new(name: filename, mtime: File.mtime(filename), size: File.size(filename)) rescue StandardError next end end |