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.



642
643
644
645
# File 'lib/ayadn/set.rb', line 642

def initialize
  super
  @category = 'colors'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/ayadn/set.rb', line 651

def method_missing(meth, options)
  @input = meth.to_s.capitalize
  @output = validate(options)
  case meth.to_s
  when 'id'
    Settings.options.colors.id = @output
  when 'index'
    Settings.options.colors.index = @output
  when 'username'
    Settings.options.colors.username = @output
  when 'name'
    Settings.options.colors.name = @output
  when 'date'
    Settings.options.colors.date = @output
  when 'link'
    Settings.options.colors.link = @output
  when 'dots'
    Settings.options.colors.dots = @output
  when 'mentions', 'mention'
    Settings.options.colors.mentions = @output
  when 'symbols', 'symbol'
    Settings.options.colors.symbols = @output
  when 'unread'
    Settings.options.colors.unread = @output
  when 'debug'
    Settings.options.colors.debug = @output
  when 'excerpt'
    Settings.options.colors.excerpt = @output
  when 'hashtag', 'tag', 'hashtags'
    Settings.options.colors.hashtag = @output
  when 'client', 'source'
    Settings.options.colors.source = @output
  else
    super
  end
end

Instance Method Details

#validate(color) ⇒ Object



647
648
649
# File 'lib/ayadn/set.rb', line 647

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