totally_tabular 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -8,6 +8,7 @@ module TotallyTabular
8
8
 
9
9
  def initialize(collection, options={}, &block)
10
10
  @collection = collection
11
+ @calling_object = options.delete(:self)
11
12
  @options = options
12
13
  @column_definition = block
13
14
  @helper = HtmlHelper.new
@@ -41,7 +42,7 @@ module TotallyTabular
41
42
  row.render(columns.map do |column|
42
43
  column.instance_exec(item, &column.definition)
43
44
  row.attributes!(column.row_attributes)
44
- @helper.content_tag(:td, column.template.call(item, row), column.cell_attributes)
45
+ @helper.content_tag(:td, @calling_object.instance_exec(item, row, &column.template), column.cell_attributes)
45
46
  end.join)
46
47
  end
47
48
  end
@@ -177,4 +177,24 @@ describe TableView do
177
177
  end
178
178
 
179
179
  end
180
+
181
+ it "should allow me to call other methods in the same class" do
182
+ class TableHelper
183
+ def embolden_text(text)
184
+ "<strong>%s</strong>" % text
185
+ end
186
+ def render_table
187
+ TableView.new(["Teamicil"], :self => self) do
188
+ define_column("Drugs") do |item|
189
+ template! do
190
+ embolden_text(item)
191
+ end
192
+ end
193
+ end.render
194
+ end
195
+ end
196
+ t = ""
197
+ lambda { t = TableHelper.new.render_table }.should_not raise_error
198
+ selector(t, "table tr td strong").inner_html.should == "Teamicil"
199
+ end
180
200
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{totally_tabular}
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joe Fiorini"]
12
- s.date = %q{2010-01-17}
12
+ s.date = %q{2010-02-06}
13
13
  s.description = %q{HTML tables are a pain in the ass. Use totaly_tabular to help make creating tables a breeze!}
14
14
  s.email = %q{joe@joefiorini.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totally_tabular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Fiorini
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-17 00:00:00 -05:00
12
+ date: 2010-02-06 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency