Class: Ayadn::SetBackup

Inherits:
Object
  • Object
show all
Defined in:
lib/ayadn/set.rb

Instance Method Summary collapse

Constructor Details

#initializeSetBackup

Returns a new instance of SetBackup.



293
294
295
296
297
298
# File 'lib/ayadn/set.rb', line 293

def initialize
  Settings.load_config
  Settings.get_token
  Settings.init_config
  Logs.create_logger
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



310
311
312
313
314
315
316
317
# File 'lib/ayadn/set.rb', line 310

def method_missing(meth, options)
  case meth.to_s
  when 'auto_save_sent_posts', 'auto_save_sent_messages', 'auto_save_lists'
    Settings.options[:backup][meth.to_sym] = options
  else
    super
  end
end

Instance Method Details

#log(args) ⇒ Object



299
300
301
302
303
# File 'lib/ayadn/set.rb', line 299

def log(args)
  x = "New value for '#{args[0]}' in 'Backup' => #{args[1]}"
  puts "\n#{x}\n".color(:cyan)
  Logs.rec.info x
end

#saveObject



304
305
306
# File 'lib/ayadn/set.rb', line 304

def save
  Settings.save_config
end

#validate(value) ⇒ Object



307
308
309
# File 'lib/ayadn/set.rb', line 307

def validate(value)
  Validators.boolean(value)
end