Class: Pinspec::Inputs::SampleRunner::Result
- Inherits:
-
Data
- Object
- Data
- Pinspec::Inputs::SampleRunner::Result
- Defined in:
- lib/pinspec/inputs/sample_runner.rb
Instance Attribute Summary collapse
-
#counts ⇒ Object
readonly
Returns the value of attribute counts.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#stratified ⇒ Object
readonly
Returns the value of attribute stratified.
Instance Method Summary collapse
Instance Attribute Details
#counts ⇒ Object (readonly)
Returns the value of attribute counts
12 13 14 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 12 def counts @counts end |
#env ⇒ Object (readonly)
Returns the value of attribute env
12 13 14 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 12 def env @env end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors
12 13 14 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 12 def errors @errors end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows
12 13 14 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 12 def rows @rows end |
#stratified ⇒ Object (readonly)
Returns the value of attribute stratified
12 13 14 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 12 def stratified @stratified end |
Instance Method Details
#all_rows ⇒ Object
31 32 33 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 31 def all_rows counts.keys.each_with_object({}) { |table, out| out[table] = rows_for(table) } end |
#empty? ⇒ Boolean
17 18 19 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 17 def empty? total_rows.zero? end |
#rows_for(table) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 21 def rows_for(table) seen = {} (Array(rows[table]) + Array(stratified[table])).each do |row| seen[row["id"] || row[:id] || row.hash] = row end seen.values end |
#total_rows ⇒ Object
13 14 15 |
# File 'lib/pinspec/inputs/sample_runner.rb', line 13 def total_rows counts.values.sum end |