Class: Storazzo::Media::LocalFolder

Inherits:
AbstractRicDisk show all
Includes:
Common
Defined in:
lib/storazzo/media/local_folder.rb

Constant Summary

Constants included from Colors

Colors::PREPEND_ME

Instance Attribute Summary collapse

Attributes inherited from AbstractRicDisk

#description

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

#bug, #deb, #err, #fatal, #if_deb?, #linux?, #mac?, #ppp, #pverbose, #warn

Methods included from Colors

#azure, #blue, #deb2, #gray, #green, #orange, #pgreen, #pred, #purple, #pwhite, #pyellow, #red, #white, #yellow

Methods inherited from AbstractRicDisk

DirFactory, abstract_class_mandatory_methods, #check_implemented_correctly, default_stats_filename, #get_local_mountpoint, list_all_with_type, #parse_block_storage_folder, #stats_file_smart_fullpath, #stats_filename_default_fullpath, super_duper_list_all_with_type, #to_s, #to_verbose_s, #unique_id, #validate

Constructor Details

#initialize(local_mount) ⇒ LocalFolder

Returns a new instance of LocalFolder.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/storazzo/media/local_folder.rb', line 11

def initialize(local_mount)
  deb "[Storazzo::Media::LocalFolder] initialize"

  @local_mountpoint = File.expand_path(local_mount)
  @description = "Local Folder originally in '#{local_mount}'"
  raise "Sorry local mount doesnt exist!" unless File.exist?(@local_mountpoint)

  @wr = writeable? # File.writable?(stats_filename_default_fullpath) # .writeable? stats_file_smart_fullpath
  # super.initialize(local_mount) rescue "SUPER_ERROR: #{$!}"
  super(local_mount) rescue "SUPER_ERROR(#{local_mount}): #{$!}"
end

Instance Attribute Details

#local_mountpointObject

Returns the value of attribute local_mountpoint.



9
10
11
# File 'lib/storazzo/media/local_folder.rb', line 9

def local_mountpoint
  @local_mountpoint
end

#wrObject

Returns the value of attribute wr.



9
10
11
# File 'lib/storazzo/media/local_folder.rb', line 9

def wr
  @wr
end

Class Method Details

.list_all(config = nil) ⇒ Object



23
24
25
26
27
28
# File 'lib/storazzo/media/local_folder.rb', line 23

def self.list_all(config = nil)
  # get lists from Config singleton
  config ||= Storazzo::RicDiskConfig.instance # # ).get_config
  config.load
  config.get_local_folders
end

Instance Method Details

#default_stats_filenameObject



43
44
45
46
# File 'lib/storazzo/media/local_folder.rb', line 43

def default_stats_filename
  # '42'
  Storazzo::RicDiskStatsFile.default_name
end

#parse(opts = {}) ⇒ Object



30
31
32
33
# File 'lib/storazzo/media/local_folder.rb', line 30

def parse(opts = {})
  puts "LF.parse(#{opts}): TODO Sbrodola inside the dir: #{local_mountpoint}"
  parse_block_storage_folder()
end

#pathObject



35
36
37
# File 'lib/storazzo/media/local_folder.rb', line 35

def path
  @local_mountpoint
end

#writeable?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/storazzo/media/local_folder.rb', line 39

def writeable?
  File.writable?(@local_mountpoint)
end