Class: Ayadn::SetCounts

Inherits:
Object
  • Object
show all
Defined in:
lib/ayadn/set.rb

Instance Method Summary collapse

Constructor Details

#initializeSetCounts

Returns a new instance of SetCounts.



321
322
323
324
325
326
# File 'lib/ayadn/set.rb', line 321

def initialize
  Settings.load_config
  Settings.get_token
  Settings.init_config
  Logs.create_logger
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, options) ⇒ Object



338
339
340
341
342
343
344
345
# File 'lib/ayadn/set.rb', line 338

def method_missing(meth, options)
  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] = options.to_i
  else
    super
  end
end

Instance Method Details

#log(args) ⇒ Object



327
328
329
330
331
# File 'lib/ayadn/set.rb', line 327

def log(args)
  x = "New value for '#{args[0]}' in 'Counts' => #{args[1]}"
  puts "\n#{x}\n".color(:cyan)
  Logs.rec.info x
end

#saveObject



332
333
334
# File 'lib/ayadn/set.rb', line 332

def save
  Settings.save_config
end

#validate(value) ⇒ Object



335
336
337
# File 'lib/ayadn/set.rb', line 335

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