table_print 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,8 +40,10 @@ module TablePrint
40
40
  cell_value = target[method.to_sym]
41
41
  elsif target.is_a? Hash and target.keys.include? method
42
42
  cell_value = target[method]
43
- else
43
+ elsif target.respond_to? method
44
44
  cell_value ||= target.send(method)
45
+ else
46
+ cell_value = "Method Missing"
45
47
  end
46
48
  cells[@column_names_by_display_method[display_method]] = cell_value
47
49
  end
@@ -1,4 +1,4 @@
1
1
  module TablePrint
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
4
4
 
@@ -130,6 +130,15 @@ describe Fingerprinter do
130
130
  row.cells.should == {'title' => 'foobar', 'author' => 'bobby'}
131
131
  end
132
132
  end
133
+
134
+ context "when the method isn't found" do
135
+ it "sets the cell value to an error string" do
136
+ f = Fingerprinter.new
137
+ f.instance_variable_set('@column_names_by_display_method', {'foo' => 'foo'})
138
+ row = f.populate_row('', {'foo' => {}}, Hash.new)
139
+ row.cells.should == {'foo' => 'Method Missing'}
140
+ end
141
+ end
133
142
  end
134
143
 
135
144
  describe "#create_child_group" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_print
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-31 00:00:00.000000000 Z
12
+ date: 2013-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cat