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.



606
607
608
609
# File 'lib/ayadn/set.rb', line 606

def initialize
  super
  @category = 'counts'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



615
616
617
618
619
620
621
622
623
624
# File 'lib/ayadn/set.rb', line 615

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



611
612
613
# File 'lib/ayadn/set.rb', line 611

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