Class: Ayadn::SetColor

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

Instance Method Summary collapse

Constructor Details

#initializeSetColor

Returns a new instance of SetColor.



379
380
381
382
383
384
# File 'lib/ayadn/set.rb', line 379

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



400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/ayadn/set.rb', line 400

def method_missing(meth, options)
  case meth.to_s
  when 'id', 'index', 'username', 'name', 'date', 'link', 'dots', 'hashtags', 'mentions', 'source', 'symbols', 'debug'
    Settings.options[:colors][meth.to_sym] = options.to_sym
  when 'hashtag', 'mention', 'symbol'
    Settings.options[:colors]["#{meth}s".to_sym] = options.to_sym
  when 'client'
    Settings.options[:colors][:source] = options.to_sym
  else
    super
  end
end

Instance Method Details

#log(args) ⇒ Object



390
391
392
393
394
# File 'lib/ayadn/set.rb', line 390

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

#saveObject



396
397
398
# File 'lib/ayadn/set.rb', line 396

def save
  Settings.save_config
end

#validate(color) ⇒ Object



386
387
388
# File 'lib/ayadn/set.rb', line 386

def validate(color)
  Validators.color(color)
end