Class: Ayadn::SetCounts

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

#initializeSetCounts

Returns a new instance of SetCounts.



554
555
556
557
# File 'lib/ayadn/set.rb', line 554

def initialize
  super
  @category = 'counts'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/ayadn/set.rb', line 563

def method_missing(meth, options)
  @input = meth.to_s.capitalize
  @output = validate(options.to_i)
  case meth.to_s
  when 'default'
    Settings.options.counts.default = @output
  when 'unified'
    Settings.options.counts.unified = @output
  when 'checkins'
    Settings.options.counts.checkins = @output
  when 'conversations'
    Settings.options.counts.conversations = @output
  when 'global'
    Settings.options.counts.global = @output
  when 'photos'
    Settings.options.counts.photos = @output
  when 'trending'
    Settings.options.counts.trending = @output
  when 'mentions'
    Settings.options.counts.mentions = @output
  when 'convo'
    Settings.options.counts.convo = @output
  when 'posts'
    Settings.options.counts.posts = @output
  when 'messages'
    Settings.options.counts.messages = @output
  when 'search'
    Settings.options.counts.search = @output
  when 'whoreposted'
    Settings.options.counts.whoreposted = @output
  when 'whostarred'
    Settings.options.counts.whostarred = @output
  when 'whatstarred'
    Settings.options.counts.whatstarred = @output
  when 'files'
    Settings.options.counts.files = @output
  else
    super
  end
end

Instance Method Details

#validate(value) ⇒ Object



559
560
561
# File 'lib/ayadn/set.rb', line 559

def validate(value)
  Validators.index_range(1, 200, value)
end