Class: Remi::Extractor::FileSystemEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/remi/data_subjects/file_system.rb

Overview

Defines properties of an entry in a filesystem.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pathname:, create_time:, modified_time:, raw: nil) ⇒ FileSystemEntry

Returns a new instance of FileSystemEntry.

Parameters:

  • pathname (String)

    The path the file system entry

  • create_time (Time)

    The time the entry was created

  • modified_time (Time)

    The time the entry was last modified

  • raw (Object) (defaults to: nil)

    An object that captures all other aspects of the entry, native to system the entry lives on



9
10
11
12
13
14
# File 'lib/remi/data_subjects/file_system.rb', line 9

def initialize(pathname:, create_time:, modified_time:, raw: nil)
  @pathname = Pathname.new(pathname)
  @create_time = create_time
  @modified_time = modified_time
  @raw = raw
end

Instance Attribute Details

#create_timeObject (readonly)

Returns the value of attribute create_time.



16
17
18
# File 'lib/remi/data_subjects/file_system.rb', line 16

def create_time
  @create_time
end

#modified_timeObject (readonly)

Returns the value of attribute modified_time.



16
17
18
# File 'lib/remi/data_subjects/file_system.rb', line 16

def modified_time
  @modified_time
end

#pathnameObject (readonly)

Returns the value of attribute pathname.



16
17
18
# File 'lib/remi/data_subjects/file_system.rb', line 16

def pathname
  @pathname
end

#rawObject (readonly)

Returns the value of attribute raw.



16
17
18
# File 'lib/remi/data_subjects/file_system.rb', line 16

def raw
  @raw
end

Instance Method Details

#nameString

Returns the base name of the entry.

Returns:

  • (String)

    the base name of the entry



19
20
21
# File 'lib/remi/data_subjects/file_system.rb', line 19

def name
  @pathname.basename.to_s
end