Class: Rexec::FileInfo
- Inherits:
-
Object
- Object
- Rexec::FileInfo
- Defined in:
- lib/rexec/file_service.rb
Overview
Represents file metadata.
Instance Attribute Summary collapse
-
#is_dir ⇒ Object
(also: #directory?)
readonly
Returns the value of attribute is_dir.
-
#mod_time ⇒ Object
readonly
Returns the value of attribute mod_time.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #file? ⇒ Boolean
-
#initialize(data) ⇒ FileInfo
constructor
A new instance of FileInfo.
Constructor Details
#initialize(data) ⇒ FileInfo
Returns a new instance of FileInfo.
10 11 12 13 14 15 16 17 |
# File 'lib/rexec/file_service.rb', line 10 def initialize(data) @name = data["name"] @path = data["path"] @size = data["size"] || 0 @mode = data["mode"] @mod_time = data["mod_time"] @is_dir = data["is_dir"] || false end |
Instance Attribute Details
#is_dir ⇒ Object (readonly) Also known as: directory?
Returns the value of attribute is_dir.
8 9 10 |
# File 'lib/rexec/file_service.rb', line 8 def is_dir @is_dir end |
#mod_time ⇒ Object (readonly)
Returns the value of attribute mod_time.
8 9 10 |
# File 'lib/rexec/file_service.rb', line 8 def mod_time @mod_time end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
8 9 10 |
# File 'lib/rexec/file_service.rb', line 8 def mode @mode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/rexec/file_service.rb', line 8 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/rexec/file_service.rb', line 8 def path @path end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
8 9 10 |
# File 'lib/rexec/file_service.rb', line 8 def size @size end |
Instance Method Details
#file? ⇒ Boolean
21 22 23 |
# File 'lib/rexec/file_service.rb', line 21 def file? !is_dir end |