Module: BrighterPlanet::Purchase::TestImpactVectorsAdapter
- Extended by:
- TestImpactVectorsAdapter
- Included in:
- TestImpactVectorsAdapter
- Defined in:
- lib/test_support/test_impact_vectors_adapter.rb
Instance Method Summary collapse
Instance Method Details
#data ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/test_support/test_impact_vectors_adapter.rb', line 14 def data matrix_text = <<-MATRIX | X |111000|3991A0|3991B0|399200|399900|4A0000| |111000|0.81 |0 |0 |0 |0 |0 | |3991A0|0 |0.546 |0 |0 |0 |0 | |3991B0|0 |0 |0.358 |0 |0 |0 | |399200|0 |0 |0 |1.2 |0 |0 | |399900|0 |0 |0 |0 |1.08 |0 | |4A0000|0 |0 |0 |0 |0 |0.623 | MATRIX lines = matrix_text.split(/\n/) lines.shift lines.map do |line| row = line.scan(/[^\s^|]+/).map(&:to_f) row.shift row end end |
#key_map ⇒ Object
6 7 8 |
# File 'lib/test_support/test_impact_vectors_adapter.rb', line 6 def key_map @key_map ||= Sector.find(:all, :order => 'io_code').map(&:io_code) end |
#matrix ⇒ Object
10 11 12 |
# File 'lib/test_support/test_impact_vectors_adapter.rb', line 10 def matrix Matrix[*data] end |