Module: Laborantin::VectorialProduct
- Defined in:
- lib/laborantin/extra/vectorial_product.rb
Instance Method Summary collapse
- #read_vector(sym) ⇒ Object
- #vector(sym = :__raw__) ⇒ Object
- #vector_file(sym) ⇒ Object
- #vectors ⇒ Object
Instance Method Details
#read_vector(sym) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/laborantin/extra/vectorial_product.rb', line 21 def read_vector(sym) vals = [] vector_file(sym) do |file| file.each_line do |line| vals << line.chomp.to_f end end vals end |
#vector(sym = :__raw__) ⇒ Object
17 18 19 |
# File 'lib/laborantin/extra/vectorial_product.rb', line 17 def vector(sym=:__raw__) vectors[sym] ||= read_vector(sym) end |
#vector_file(sym) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/laborantin/extra/vectorial_product.rb', line 8 def vector_file(sym) blk = lambda {|f| yield f} if sym == :__raw__ raw_result_file &blk else product_file(sym, &blk) end end |
#vectors ⇒ Object
4 5 6 |
# File 'lib/laborantin/extra/vectorial_product.rb', line 4 def vectors @vectors ||= {} end |