Class: EziiOsPath

Inherits:
Object
  • Object
show all
Defined in:
app/models/ezii_os_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global_path) ⇒ EziiOsPath

Returns a new instance of EziiOsPath.



8
9
10
11
# File 'app/models/ezii_os_path.rb', line 8

def initialize(global_path)
  self.global_path = global_path
  self.file_system = FileSystem.find_by(machine_readable_identifier: file_system_identifier)
end

Instance Attribute Details

#dropbox_metainfoObject

should be refactored



4
5
6
# File 'app/models/ezii_os_path.rb', line 4

def dropbox_metainfo
  @dropbox_metainfo
end

#file_systemObject

should stay for longer



2
3
4
# File 'app/models/ezii_os_path.rb', line 2

def file_system
  @file_system
end

#global_pathObject

should stay for longer



2
3
4
# File 'app/models/ezii_os_path.rb', line 2

def global_path
  @global_path
end

#https_urlObject

hacky



6
7
8
# File 'app/models/ezii_os_path.rb', line 6

def https_url
  @https_url
end

#local_file_system_pathObject

hacky



6
7
8
# File 'app/models/ezii_os_path.rb', line 6

def local_file_system_path
  @local_file_system_path
end

Instance Method Details

#file?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/models/ezii_os_path.rb', line 29

def file?
  self.file_system.file?(self)
end

#file_system_identifierObject



17
18
19
# File 'app/models/ezii_os_path.rb', line 17

def file_system_identifier
  global_path.match(/\/([^\/]+)/)[1]
end

#file_system_pathObject



13
14
15
# File 'app/models/ezii_os_path.rb', line 13

def file_system_path
  global_path.sub(/\/[^\/]+/, '')
end

#inspectObject



25
26
27
# File 'app/models/ezii_os_path.rb', line 25

def inspect
  global_path
end

#modified_atObject



33
34
35
# File 'app/models/ezii_os_path.rb', line 33

def modified_at
  self.file_system.path_modified_at(self)
end

#to_sObject



21
22
23
# File 'app/models/ezii_os_path.rb', line 21

def to_s
  file_system_path
end