Class: PeaceOfMind::Base

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/peace_of_mind/base.rb

Class Method Summary collapse

Class Method Details

.archive_filename(value = nil) ⇒ Object Also known as: archive_filename=



36
37
38
# File 'lib/peace_of_mind/base.rb', line 36

def archive_filename(value = nil)
  rw_config(:archive_filename, value, 'peace_of_mind')
end

.create!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/peace_of_mind/base.rb', line 8

def create!
  timestamp = Time.now.strftime("%Y%m%d%H%M%S")
  remove_peace_of_mind_path!
  create_peace_of_mind_path!
  dump_database
  tar_peace_of_mind_path!(timestamp)
  store_data!(timestamp)
  super(
    :bucket     => bucket,
    :filename   => tar_filename(timestamp),
    :timestamp  => timestamp,
    :size       => File.size(File.join(peace_of_mind_path, tar_filename(timestamp)))
  )
  remove_peace_of_mind_path!
end

.has_peace_of_mind {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



24
25
26
27
28
29
# File 'lib/peace_of_mind/base.rb', line 24

def has_peace_of_mind
  # Stop all configuration if the DB is not set up
  return if !db_setup?
    
  yield self if block_given?
end

.tmp_directory(value = nil) ⇒ Object Also known as: tmp_directory=



31
32
33
# File 'lib/peace_of_mind/base.rb', line 31

def tmp_directory(value = nil)
  rw_config(:tmp_directory, value, File.join(RAILS_ROOT, "tmp"))
end