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



579
580
581
582
# File 'lib/ayadn/set.rb', line 579

def initialize
  super
  @category = 'colors'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



588
589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/ayadn/set.rb', line 588

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', 'unread', 'debug', 'excerpt'
    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



584
585
586
# File 'lib/ayadn/set.rb', line 584

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