Skip to content

Commit

Permalink
run example scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
ruan committed Sep 17, 2010
1 parent cc5f208 commit 4b802b0
Show file tree
Hide file tree
Showing 5 changed files with 965 additions and 7 deletions.
Binary file removed lib/rmu_data/.table.rb.swp
Binary file not shown.
16 changes: 15 additions & 1 deletion lib/rmu_data/table.rb
Expand Up @@ -113,10 +113,24 @@ def transform_column(position, &block)
end
def select(&block)
@input_data.select &block
result_row_list=Array.new
@input_data.each_with_index do |row,i|
result_row_list << row if block.call ArrayIndexByStr.new(row,@header)
end
@input_data=result_row_list
end
def select_column(&block)
length=@input_data.first.length
result_column_list=Array.new
length.times.each do |column|
this_column=Array.new
@input_data.each do |row|
this_column << row[column]
end
result_column_list << this_column if block.call this_column
end
@input_data=result_column_list
end
end
Expand Down

0 comments on commit 4b802b0

Please sign in to comment.