Class: MstdnAnalyzer::Analyzer

Inherits:
Object
  • Object
show all
Defined in:
lib/mstdn_analyzer/analyzer.rb

Constant Summary collapse

COLORS =
{ black: "\e[30m", red: "\e[31m", green: "\e[32m", yellow: "\e[33m", blue: "\e[34m", mugenta: "\e[35m", cyan: "\e[36m", white: "\e[37m", reset: "\e[m"}
BACKGROUND_COLORS =
{ black: "\e[40m", red: "\e[41m", green: "\e[42m", yellow: "\e[43m", blue: "\e[44m", mugenta: "\e[45m", cyan: "\e[46m", white: "\e[47m", reset: "\e[m"}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance, username, **options) ⇒ Analyzer

Returns a new instance of Analyzer.



14
15
16
17
18
19
20
21
22
23
# File 'lib/mstdn_analyzer/analyzer.rb', line 14

def initialize(instance, username, **options)
  # オプションの解析

  limit = options[:limit] || 5000
  is_inore_reblog = options[:ignore_reblog]

  @instance = get_correct_instance(instance)
  @client = MstdnIvory::Client.new(@instance)
  @account = get_id_from_username(username)
  @statuses = get_statuses(limit, is_inore_reblog)
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



9
10
11
# File 'lib/mstdn_analyzer/analyzer.rb', line 9

def 
  @account
end

#cleintObject

Returns the value of attribute cleint.



9
10
11
# File 'lib/mstdn_analyzer/analyzer.rb', line 9

def cleint
  @cleint
end

#instanceObject

Returns the value of attribute instance.



9
10
11
# File 'lib/mstdn_analyzer/analyzer.rb', line 9

def instance
  @instance
end

#statusesObject

Returns the value of attribute statuses.



9
10
11
# File 'lib/mstdn_analyzer/analyzer.rb', line 9

def statuses
  @statuses
end

Instance Method Details

#resultObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mstdn_analyzer/analyzer.rb', line 25

def result
  puts "Daily activity distribution(per hour)"
  puts_line
  display_activity_per_hour
  puts_line
  puts
  puts "Weekley activity distribution(per day)"
  puts_line
  display_activity_per_day
  puts_line
end