Class: Ayadn::SetCounts
- Inherits:
-
Object
- Object
- Ayadn::SetCounts
- Defined in:
- lib/ayadn/set.rb
Instance Method Summary collapse
-
#initialize ⇒ SetCounts
constructor
A new instance of SetCounts.
- #log(args) ⇒ Object
- #method_missing(meth, options) ⇒ Object
- #save ⇒ Object
- #validate(value) ⇒ Object
Constructor Details
#initialize ⇒ SetCounts
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, ) case meth.to_s when 'default', 'unified', 'checkins', 'conversations', 'global', 'photos', 'trending', 'mentions', 'convo', 'posts', 'messages', 'search', 'whoreposted', 'whostarred', 'whatstarred', 'files' Settings.[:counts][meth.to_sym] = .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 |
#save ⇒ Object
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 |