Class: RbRotate::StateModule::Archive

Inherits:
Object
  • Object
show all
Defined in:
lib/rb.rotate/state/archive.rb

Overview

 State file archive section.

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Archive

Constructor.



22
23
24
# File 'lib/rb.rotate/state/archive.rb', line 22

def initialize(data)
    @data = data
end

Instance Method Details

#file(path) ⇒ Object

Returns file data.



30
31
32
# File 'lib/rb.rotate/state/archive.rb', line 30

def file(path)
    self.files[path.to_sym]
end

#filesObject

Returns files data.



38
39
40
# File 'lib/rb.rotate/state/archive.rb', line 38

def files
    @data[:files]
end

#has_directory?(path) ⇒ Boolean

Indicates, directory is in archive.

Returns:

  • (Boolean)


54
55
56
# File 'lib/rb.rotate/state/archive.rb', line 54

def has_directory?(path)
    @data[:directories].has_key? path.to_sym
end

#has_file?(path) ⇒ Boolean

Indicates, file is in archive.

Returns:

  • (Boolean)


46
47
48
# File 'lib/rb.rotate/state/archive.rb', line 46

def has_file?(path)
    @data[:files].has_key? path.to_sym
end

#register_directory(path, value = true) ⇒ Object

Registers directory.



79
80
81
# File 'lib/rb.rotate/state/archive.rb', line 79

def register_directory(path, value = true)
    self.register_item(:directories, path, value)
end

#register_file(path, value = true) ⇒ Object

Registers file.



62
63
64
# File 'lib/rb.rotate/state/archive.rb', line 62

def register_file(path, value = true)
    self.register_item(:files, path, value)
end

#register_item(group, path, value = true) ⇒ Object

Registers item.



95
96
97
# File 'lib/rb.rotate/state/archive.rb', line 95

def register_item(group, path, value = true)
    @data[group][path.to_sym] = value
end

#unregister_directory(path) ⇒ Object

Unregisters file.



87
88
89
# File 'lib/rb.rotate/state/archive.rb', line 87

def unregister_directory(path)
    self.unregister_item(:directories, path)
end

#unregister_file(path) ⇒ Object

Unregisters file.



70
71
72
# File 'lib/rb.rotate/state/archive.rb', line 70

def unregister_file(path)
    self.unregister_item(:files, path)
end

#unregister_item(group, path) ⇒ Object

Unregister item.



103
104
105
# File 'lib/rb.rotate/state/archive.rb', line 103

def unregister_item(group, path)
    @data[group].delete(path.to_sym)
end