Class: Ayadn::SetColor
- Inherits:
-
Object
- Object
- Ayadn::SetColor
- Defined in:
- lib/ayadn/set.rb
Instance Method Summary collapse
-
#initialize ⇒ SetColor
constructor
A new instance of SetColor.
- #log(args) ⇒ Object
- #method_missing(meth, options) ⇒ Object
- #save ⇒ Object
- #validate(color) ⇒ Object
Constructor Details
#initialize ⇒ SetColor
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, ) case meth.to_s when 'id', 'index', 'username', 'name', 'date', 'link', 'dots', 'hashtags', 'mentions', 'source', 'symbols', 'debug' Settings.[:colors][meth.to_sym] = .to_sym when 'hashtag', 'mention', 'symbol' Settings.[:colors]["#{meth}s".to_sym] = .to_sym when 'client' Settings.[:colors][:source] = .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 |
#save ⇒ Object
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 |