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

#dataObject



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 = "|  X   |111000|3991A0|3991B0|399200|399900|4A0000|\n|111000|0.81  |0     |0     |0     |0     |0     |\n|3991A0|0     |0.546 |0     |0     |0     |0     |\n|3991B0|0     |0     |0.358 |0     |0     |0     |\n|399200|0     |0     |0     |1.2   |0     |0     |\n|399900|0     |0     |0     |0     |1.08  |0     |\n|4A0000|0     |0     |0     |0     |0     |0.623 |\n  MATRIX\n  lines = matrix_text.split(/\\n/)\n  lines.shift\n  lines.map do |line|\n    row = line.scan(/[^\\s^|]+/).map(&:to_f)\n    row.shift\n    row\n  end\nend\n"

#key_mapObject



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

#matrixObject



10
11
12
# File 'lib/test_support/test_impact_vectors_adapter.rb', line 10

def matrix
  Matrix[*data]
end