lib/transformers/multipasser.rb in optimus-ep-0.6.91 vs lib/transformers/multipasser.rb in optimus-ep-0.8.0

- old
+ new

@@ -1,8 +1,8 @@ # Part of the Optimus package for managing E-Prime data # -# Copyright (C) 2008 Board of Regents of the University of Wisconsin System +# Copyright (C) 2008-09 Board of Regents of the University of Wisconsin System # # Written by Nathan Vack <njvack@wisc.edu>, at the Waisman Laborotory for Brain # Imaging and Behavior, University of Wisconsin - Madison # This class provides the ability for a dataset to be 'exploded' into more @@ -18,18 +18,22 @@ # fixation 100 # stimulus 130 require 'transformers/column_calculator' require 'transformers/row_filter' +require 'parsed_calculator' -module Eprime +module Optimus module Transformers class Multipasser class Pass attr_accessor :sort_expression, :row_filter, :computed_columns - def initialize(sort_expression = "1", row_filter = lambda{|r| true}, computed_columns = []) + def initialize( + sort_expression = "1", + row_filter = lambda{|r| true}, + computed_columns = []) @sort_expression = sort_expression @row_filter = row_filter @computed_columns = computed_columns end @@ -54,11 +58,11 @@ @data = data reset! end def add_pass(*args) - @computed = nil + reset! if args[0].instance_of? Pass p = args[0] else p = Pass.new(*args) end @@ -78,16 +82,16 @@ return @computed if @computed if @passes.empty? @computed = @data return @computed end - @computed = Eprime::Data.new + @computed = Optimus::Data.new # Just add a simple pass if we don't have any... @passes.each do |pass| # We want to duplicate the data, add a sort expression to it, add # computed columns, filter it, and then merge it into the complete # dataset. - #cur_data = @data.to_eprime_data + #cur_data = @data.to_optimus_data comp_data = ColumnCalculator.new comp_data.data = @data comp_data.sort_expression = pass.sort_expression pass.computed_columns.each do |col| name, expr = *col \ No newline at end of file