Class: AttributeStats::SetAttributeStats

Inherits:
Object
  • Object
show all
Includes:
Terminal
Defined in:
lib/stats_generation/set_attribute_stats.rb

Constant Summary

Constants included from Terminal

Terminal::CLEAR_LINE_TO_RIGHT, Terminal::GREEN, Terminal::LINE_ABOVE, Terminal::RED, Terminal::RESET_COLOR, Terminal::START_OF_NEXT_LINE

Instance Method Summary collapse

Methods included from Terminal

#erase_line, #green, #in_color, #red

Constructor Details

#initialize(table_info: [], options: {}) ⇒ SetAttributeStats



6
7
8
# File 'lib/stats_generation/set_attribute_stats.rb', line 6

def initialize(table_info: [], options: {})
  @table_info, @options = table_info, options
end

Instance Method Details

#set_countsObject



10
11
12
13
# File 'lib/stats_generation/set_attribute_stats.rb', line 10

def set_counts
  @query_method = :count
  set_stats
end

#set_emptyObject



15
16
17
18
# File 'lib/stats_generation/set_attribute_stats.rb', line 15

def set_empty
  @query_method = :exists?
  set_stats
end

#set_statsObject



20
21
22
23
24
25
26
27
# File 'lib/stats_generation/set_attribute_stats.rb', line 20

def set_stats
  @table_info.each_with_index do |t,index|
    @table_count = index
    fetch_table_stats(t)
  end
  erase_line if @options[:verbose]
  true
end