Class: Prime8::ReportTable
- Inherits:
-
Object
- Object
- Prime8::ReportTable
show all
- Includes:
- CommandLineReporter, Multiplication
- Defined in:
- lib/prime_8/report_table.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
#row_columns, #table_rows
Constructor Details
#initialize(count = 10) ⇒ ReportTable
Returns a new instance of ReportTable.
11
12
13
14
|
# File 'lib/prime_8/report_table.rb', line 11
def initialize(count=10)
@count = count
@primes = Prime8::Strategies.default.get_through_nth_prime(@count)
end
|
Instance Attribute Details
#primes ⇒ Object
Returns the value of attribute primes.
10
11
12
|
# File 'lib/prime_8/report_table.rb', line 10
def primes
@primes
end
|
Instance Method Details
#row_datum ⇒ Object
20
21
22
|
# File 'lib/prime_8/report_table.rb', line 20
def row_datum
table_rows(@primes)
end
|
#run ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/prime_8/report_table.rb', line 24
def run
table :border => true do
row :header => true do
table_headings.each do |prime|
column(prime.to_s, :align => 'center', :width => 5, :color => 'blue')
end
end
row_datum.each do |row_data|
row do
column(row_data.slice!(0).to_s, :align => 'center', :width => 5, :bold => true, :color => 'blue')
end
row_data.each do |rd|
column(rd.to_s, :align => 'center', :width => 5)
end
end
end
end
|
#table_headings ⇒ Object
16
17
18
|
# File 'lib/prime_8/report_table.rb', line 16
def table_headings
[""]+@primes
end
|