Class: ADNCV::Display

Inherits:
Object
  • Object
show all
Defined in:
lib/ADNCV/display.rb

Instance Method Summary collapse

Constructor Details

#initializeDisplay

Returns a new instance of Display.



5
6
7
# File 'lib/ADNCV/display.rb', line 5

def initialize
  @thor = Thor::Shell::Color.new
end

Instance Method Details

#analyzingObject



13
14
15
16
# File 'lib/ADNCV/display.rb', line 13

def analyzing
  puts "\n"
  @thor.say_status :working, "Analyzing JSON file", :yellow
end

#clear_screenObject



26
27
28
# File 'lib/ADNCV/display.rb', line 26

def clear_screen
  puts "\e[H\e[2J"
end

#doneObject



18
19
20
# File 'lib/ADNCV/display.rb', line 18

def done
  @thor.say_status :done, "Parsed and sorted", :green
end

#exported(filename) ⇒ Object



22
23
24
# File 'lib/ADNCV/display.rb', line 22

def exported(filename)
  @thor.say_status :done, "Data exported in #{filename}", :green
end

#show(data, options) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ADNCV/display.rb', line 30

def show(data, options)
  clear_screen()
  puts "Total posts:".ljust(50) + "#{data.count}" + "\n\n"
  puts "Without mentions:".ljust(50) + "#{data.without_mentions}" + "\n\n"
  puts "Directed to a user:".ljust(50) + "#{data.leadings}" + "\n\n"
  puts "Containing mentions but not directed:".ljust(50) + "#{data.mentions_not_directed}" + "\n\n"
  puts "Containing mentions and are replies:".ljust(50) + "#{data.replies}" + "\n\n"
  puts "Containing mentions and are not replies:".ljust(50) + "#{data.mentions_not_replies}" + "\n\n"
  puts "Containing links:".ljust(50) + "#{data.with_links}" + "\n\n"
  puts "Times your posts have been reposted:".ljust(50) + "#{data.reposts}" + "\n\n"
  puts "Times your posts have been starred:".ljust(50) + "#{data.stars}" + "\n\n"
  puts "Users you've posted directly to:".ljust(50) + "#{data.directed_users.size}" + "\n\n"
  puts "Users you've mentioned:".ljust(50) + "#{data.names.size}" + "\n\n"
  puts "You've posted with #{data.clients.size} clients:\n\n#{data.sources.reverse.join(', ')}" + "\n\n"
  if options["full"]
    puts "Your posted links:".ljust(50) + "#{data.all_links.join(', ')}" + "\n\n"
    puts "Users you've posted directly to: #{data.directed_users.reverse.join(', ')}" + "\n\n"
    puts "Users you've mentioned: #{data.names.reverse.join(', ')}" + "\n\n"
  end
end

#versionObject



9
10
11
# File 'lib/ADNCV/display.rb', line 9

def version
  @thor.say_status :version, "#{VERSION}", :red
end