Class: Ayadn::SetColor

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

Instance Attribute Summary

Attributes inherited from SetBase

#category, #input, #output

Instance Method Summary collapse

Methods inherited from SetBase

#log, #save

Constructor Details

#initializeSetColor

Returns a new instance of SetColor.



447
448
449
450
# File 'lib/ayadn/set.rb', line 447

def initialize
  super
  @category = 'colors'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



456
457
458
459
460
461
462
463
464
465
466
467
468
469
# File 'lib/ayadn/set.rb', line 456

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

Instance Method Details

#validate(color) ⇒ Object



452
453
454
# File 'lib/ayadn/set.rb', line 452

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