Class: Ayadn::Debug

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

Class Method Summary collapse

Class Method Details

.db(dbs) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ayadn/debug.rb', line 15

def self.db dbs
  if Settings.options[:timeline][:show_debug] == true
    puts "/////\nSETTINGS\n"
    jj JSON.parse((Settings.config).to_json)
    jj JSON.parse((Settings.options).to_json)
    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"
    end
    puts ">>>>>\n\n"

    puts "^^^^^\nTOKEN\n"
    puts Settings.user_token
    puts "^^^^^\n\n"
  end
end

.err(error) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/ayadn/debug.rb', line 34

def self.err error
  if Settings.options[:timeline][:show_debug] == true
    puts "--*--\nTRACE:\n"
    raise error
    puts "\n--*--\n\n"
  end
end

.how_many_ranks(niceranks, get_these) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/ayadn/debug.rb', line 42

def self.how_many_ranks niceranks, get_these
  if Settings.options[: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])
  end
end

.http(response, url) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/ayadn/debug.rb', line 5

def self.http response, url
  if Settings.options[: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])
  end
end

.niceranks_error(resp) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/ayadn/debug.rb', line 61

def self.niceranks_error resp
  if Settings.options[:timeline][:show_debug] == true
    deb = "=====\n"
    deb << "NR Error:\t#{resp}\n"
    deb << "=====\n"
    puts deb.color(Settings.options[:colors][:debug])
  end
end

.ranks_pool(niceranks) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/ayadn/debug.rb', line 52

def self.ranks_pool niceranks
  if Settings.options[:timeline][:show_debug] == true
    deb = "=====\n"
    deb << "NR in pool:\t#{niceranks}\n"
    deb << "=====\n"
    puts deb.color(Settings.options[:colors][:debug])
  end
end

.stream(stream, options, target) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/ayadn/debug.rb', line 80

def self.stream stream, options, target
  if Settings.options[: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])
  end
end

.total_ranks(niceranks) ⇒ Object



70
71
72
73
74
75
76
77
78
# File 'lib/ayadn/debug.rb', line 70

def self.total_ranks niceranks
  if Settings.options[: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])
  end
end