Class: Rexec::FileInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/rexec/file_service.rb

Overview

Represents file metadata.

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dirObject (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_timeObject (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

#modeObject (readonly)

Returns the value of attribute mode.



8
9
10
# File 'lib/rexec/file_service.rb', line 8

def mode
  @mode
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/rexec/file_service.rb', line 8

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/rexec/file_service.rb', line 8

def path
  @path
end

#sizeObject (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

Returns:

  • (Boolean)


21
22
23
# File 'lib/rexec/file_service.rb', line 21

def file?
  !is_dir
end