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.



531
532
533
534
# File 'lib/ayadn/set.rb', line 531

def initialize
  super
  @category = 'counts'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



540
541
542
543
544
545
546
547
548
549
# File 'lib/ayadn/set.rb', line 540

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

Instance Method Details

#validate(value) ⇒ Object



536
537
538
# File 'lib/ayadn/set.rb', line 536

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