Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename column method to define_column

  • Loading branch information...
commit 262718fb620157a73fcf7c2faa4aba75e3e18cec 1 parent ceeaf51
Joe Fiorini authored
2  lib/totally_tabular/table.rb
View
@@ -6,7 +6,7 @@ def initialize
@columns = []
end
- def column(name, header_attributes={}, &block)
+ def define_column(name, header_attributes={}, &block)
column = Column.new(name)
block.call(column)
column.header_attributes = header_attributes
16 spec/lib/totally_tabular/table_view_spec.rb
View
@@ -13,7 +13,7 @@ def selector(string, selector)
before do
@table_view = TableView.new([]) do
- column("col") do |o|
+ define_column("col") do |o|
end
end
end
@@ -38,7 +38,7 @@ def selector(string, selector)
table_class = "CLASS"
t = TableView.new([], :class => table_class) do |table|
- table.column("col") do |o|
+ table.define_column("col") do |o|
end
end
@@ -47,7 +47,7 @@ def selector(string, selector)
it "should render with cellpadding, cellspacing" do
t = TableView.new([], :cellpadding => 0, :cellspacing => 0) do |table|
- table.column("col") do |o|
+ table.define_column("col") do |o|
end
end
@@ -63,12 +63,12 @@ def selector(string, selector)
o3 = OpenStruct.new(:name => "Gary", :coolness => "Eh.", :age => 26)
o4 = OpenStruct.new(:name => "Josh", :coolness => "Lame.", :age => 26)
@table_view = TableView.new([o, o2, o3, o4]) do |t|
- t.column("Name") do |column|
+ t.define_column("Name") do |column|
column.template! do |o, row|
"%s is %s" % [o.name, o.coolness]
end
end
- t.column("Age") do |column|
+ t.define_column("Age") do |column|
column.template! do |o, row|
o.age
end
@@ -94,7 +94,7 @@ def selector(string, selector)
it "allows defining class on header" do
t = TableView.new([1]) do
- column("Blah", :class => "blahdiddy") do |column|
+ define_column("Blah", :class => "blahdiddy") do |column|
column.template! do |o, row|
end
end
@@ -117,7 +117,7 @@ def selector(string, selector)
it "should allow me to define a column" do
column_definition = Proc.new do
- column("Joe") do |column|
+ define_column("Joe") do |column|
column.template! do
end
end
@@ -129,7 +129,7 @@ def selector(string, selector)
it "should allow defining the column body when defining the column" do
t = TableView.new(["Judge"]) do
- column("Name") do |column|
+ define_column("Name") do |column|
column.template! do |item, row|
"My name is %s." % item
end
Please sign in to comment.
Something went wrong with that request. Please try again.