Permalink
Browse files

Addec max column support to factory. Bumped version

  • Loading branch information...
1 parent 81e2a43 commit 3f3a6a0b01344a7da2a3c134146615fb464bef69 Brad Seefeld committed Jun 8, 2011
Showing with 12 additions and 1 deletion.
  1. +4 −0 lib/rgviz/data_table/column.rb
  2. +1 −1 lib/rgviz/data_table/version.rb
  3. +7 −0 spec/rgviz/data_table/column_spec.rb
@@ -10,6 +10,10 @@ def self.factory(statement)
col = Rgviz::DataTable::SumColumn.new(m[1], statement)
end
+ if m = statement.match(/max\((.*)\)/i)
+ col = Rgviz::DataTable::MaxColumn.new(m[1], statement)
+ end
+
unless col
col = Rgviz::DataTable::Column.new(statement)
end
@@ -1,5 +1,5 @@
module Rgviz
module DataTable
- VERSION = "0.0.4"
+ VERSION = "0.0.5"
end
end
@@ -9,6 +9,13 @@
col.label.should == "sum(column)"
end
+ it "creates a max column" do
+ col = Rgviz::DataTable::Column.factory("max(column)")
+ col.is_a?(Rgviz::DataTable::MaxColumn).should be_true
+ col.column.should == "column"
+ col.label.should == "max(column)"
+ end
+
it "strips extra space" do
col = Rgviz::DataTable::Column.factory(" some_column ")
col.class.should == Rgviz::DataTable::Column

0 comments on commit 3f3a6a0

Please sign in to comment.