Class: Ayadn::Debug
- Inherits:
-
Object
- Object
- Ayadn::Debug
- Defined in:
- lib/ayadn/debug.rb
Class Method Summary collapse
- .db(dbs) ⇒ Object
- .err(error, stack) ⇒ Object
- .how_many_ranks(niceranks, get_these) ⇒ Object
- .http(response, url) ⇒ Object
- .niceranks_error(resp) ⇒ Object
- .ranks_pool(niceranks) ⇒ Object
- .skipped(dic) ⇒ Object
- .stream(stream, options, target) ⇒ Object
- .total_ranks(niceranks) ⇒ Object
Class Method Details
.db(dbs) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ayadn/debug.rb', line 23 def self.db dbs if Settings.[:timeline][:show_debug] == true # puts "/////\nSETTINGS\n" # jj JSON.parse((Settings.config).to_json) # jj JSON.parse((Settings.options).to_json) # Logs.rec.debug "SETTINGS/CONFIG: #{Settings.config}" # Logs.rec.debug "SETTINGS/OPTIONS: #{Settings.options}" # puts "/////\n\n" #puts ">>>>>\nDATABASES\n" dbs.each do |db| #puts "Path:\t#{db.file}\nLength:\t#{db.size}\nSize:\t#{db.bytesize / 1024}KB" Logs.rec.debug "DB: #{File.basename(db.file)} - Length: #{db.size}, Size: #{db.bytesize / 1024}KB" end #puts ">>>>>\n\n" # puts "^^^^^\nTOKEN\n" # puts Settings.user_token # puts "^^^^^\n\n" end end |
.err(error, stack) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/ayadn/debug.rb', line 45 def self.err error, stack if Settings.[:timeline][:show_debug] == true puts "\n--*--\nERROR:\n" raise error puts "\n--*--\nSTACK:\n" puts stack puts "\n--*--\n\n" end end |
.how_many_ranks(niceranks, get_these) ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ayadn/debug.rb', line 55 def self.how_many_ranks niceranks, get_these if Settings.[:timeline][:show_debug] == true # deb = "=====\n" # deb << "NR from DB:\t#{niceranks}\n\n" # deb << "NR to get:\t#{get_these}\n" # deb << "=====\n" # puts deb.color(Settings.options[:colors][:debug]) Logs.rec.debug "NR/FROM DB: #{niceranks}" Logs.rec.debug "NR/TO GET: #{get_these}" end end |
.http(response, url) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ayadn/debug.rb', line 11 def self.http response, url if Settings.[:timeline][:show_debug] == true # deb = ":::::\n" # deb << "Url:\t\t#{url}\n\n" # deb << "Headers:\t#{response.headers}\n" # deb << ":::::\n" # puts deb.color(Settings.options[:colors][:debug]) Logs.rec.debug "HTTP/URL: #{url}" Logs.rec.debug "HTTP/HEADERS: #{response.headers}" end end |
.niceranks_error(resp) ⇒ Object
77 78 79 80 81 82 83 84 85 |
# File 'lib/ayadn/debug.rb', line 77 def self.niceranks_error resp if Settings.[:timeline][:show_debug] == true # deb = "=====\n" # deb << "NR Error:\t#{resp}\n" # deb << "=====\n" # puts deb.color(Settings.options[:colors][:debug]) Logs.rec.error "NR/ERROR: #{resp}" end end |
.ranks_pool(niceranks) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/ayadn/debug.rb', line 67 def self.ranks_pool niceranks if Settings.[:timeline][:show_debug] == true # deb = "=====\n" # deb << "NR in pool:\t#{niceranks}\n" # deb << "=====\n" # puts deb.color(Settings.options[:colors][:debug]) Logs.rec.debug "NR/IN POOL: #{niceranks}" end end |
.skipped(dic) ⇒ Object
5 6 7 8 9 |
# File 'lib/ayadn/debug.rb', line 5 def self.skipped dic if Settings.[:timeline][:show_debug] == true Logs.rec.debug "SKIPPED: #{dic.keys.first.to_s.capitalize} => #{dic.values.first}" end end |
.stream(stream, options, target) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/ayadn/debug.rb', line 99 def self.stream stream, , target if Settings.[:timeline][:show_debug] == true # deb = "+++++\nStream meta:\t#{stream['meta']}\n\n" # deb << "Options:\t#{options.inspect}\n\n" # deb << "Target:\t\t#{target.inspect}\n\n" # deb << "Posts:\t\t#{stream['data'].length}\n+++++\n" # puts deb.color(Settings.options[:colors][:debug]) Logs.rec.debug "STREAM/META: #{stream['meta']}" Logs.rec.debug "STREAM/OPTIONS: #{options.inspect}" Logs.rec.debug "STREAM/TARGET: #{target.inspect}" Logs.rec.debug "STREAM/POSTS: #{stream['data'].length}" end end |
.total_ranks(niceranks) ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/ayadn/debug.rb', line 87 def self.total_ranks niceranks if Settings.[:timeline][:show_debug] == true # deb = "=====\n" # deb << "NiceRanks:\t#{niceranks}\n\n" # deb << "DB size:\t#{Databases.nicerank.size}\n" # deb << "=====\n" # puts deb.color(Settings.options[:colors][:debug]) Logs.rec.debug "NR/RANKS: #{niceranks}" Logs.rec.debug "NR/DB SIZE: #{Databases.nicerank.size}" end end |