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
12
# 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)
  self.complementary_local_file_system_paths = []
end

Instance Attribute Details

#complementary_local_file_system_pathsObject

hacky



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

def complementary_local_file_system_paths
  @complementary_local_file_system_paths
end

#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)


38
39
40
# File 'app/models/ezii_os_path.rb', line 38

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

#file_system_identifierObject



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

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

#file_system_pathObject



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

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

#hacky_split_path(*args) ⇒ Object



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

def hacky_split_path(*args)
  to_s.split(*args)
end

#inspectObject



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

def inspect
  global_path
end

#modified_atObject



42
43
44
# File 'app/models/ezii_os_path.rb', line 42

def modified_at
  self.file_system.path_modified_at(self)
end

#split(*args) ⇒ Object



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

def split(*args)
  hacky_split_path(*args)
end

#to_sObject



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

def to_s
  file_system_path
end