Class: FileSystem

Inherits:
ApplicationRecord show all
Defined in:
app/models/file_system.rb

Overview

typed: true

Instance Method Summary collapse

Instance Method Details

#file?(path) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
# File 'app/models/file_system.rb', line 16

def file?(path)
    case machine_readable_identifier
    when 'local'
        File.file?(path.file_system_path)
    when 'dropbox'
        path.dropbox_metainfo[".tag"] == 'file'
    end
end

#path_modified_at(path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/models/file_system.rb', line 3

def path_modified_at(path)
    case machine_readable_identifier
    when 'local'
        File.mtime(path.file_system_path)
    when 'dropbox'
        if file?(path)
            Time.parse(path.dropbox_metainfo['server_modified'])
        else
            return nil
        end
    end
end