ztk 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51995730c367aad573a7ef3e29511b467db4b66f
4
- data.tar.gz: ff200826eedc9d5578dba75a466e624a94a36101
3
+ metadata.gz: 8badf087e5931acd921eb426237ac5051ca030be
4
+ data.tar.gz: 9205a2b46ab8398b6febad97032c0f97025e180d
5
5
  SHA512:
6
- metadata.gz: 603fbd897d88db627ed8a305671d53704009bb768d91c08225ba6416966a67e59e787c7da547f4d4536fa44343dff859678d8686ebf1feaebe61f8c19fb038ac
7
- data.tar.gz: 3c50cfb817e364ee304d5c30514ee5bc45e2c1a152b5cad2b246e86cb2c875037b23f91e054e447790983a94701f8d103228fedd21b604967e93d539a36b23b1
6
+ metadata.gz: 0fea23299111a92fd68dc656dc58df2a8aeea022094ca001ca0b3fc7367e713739f87b0b8bc9a267777f1b8ecdea131be3276d6eb56d16b47cf354256ca444f2
7
+ data.tar.gz: 16205e8f74d1df7a6c2883c0dad97d1071265a36dd6ca7d2113af9ffacd4dfe41014a1083c60bdc98ab7bcf085d02439354d270fcd453647a06e9c06234a23de
@@ -43,14 +43,14 @@ module ZTK
43
43
 
44
44
  if rows.count > 0
45
45
  max_key_length = headers.collect{ |header| header.to_s.length }.max
46
- max_value_length = rows.collect{ |row| headers.collect{ |header| row.send(:table)[header].to_s.length }.max }.max
46
+ max_value_length = rows.collect{ |row| headers.collect{ |header| (row.send(:table) rescue row)[header].to_s.length }.max }.max
47
47
 
48
48
  width = (max_key_length + max_value_length + 2 + 2 + 2)
49
49
 
50
50
  rows.each do |row|
51
51
  config.ui.stdout.puts("+#{"-" * width}+")
52
52
  headers.each do |header|
53
- entry_line = format_entry(header, max_key_length, row.send(:table)[header], max_value_length)
53
+ entry_line = format_entry(header, max_key_length, (row.send(:table) rescue row)[header], max_value_length)
54
54
  config.ui.stdout.puts(entry_line)
55
55
  end
56
56
  end
@@ -7,9 +7,9 @@ module ZTK
7
7
  def max_spreadsheet_lengths(headers, rows)
8
8
  max_lengths = OpenStruct.new
9
9
  headers.each do |header|
10
- collection = [header, rows.collect{|r| r.send(:table)[header] } ].flatten
10
+ collection = [header, rows.collect{|r| (r.send(:table) rescue r)[header] } ].flatten
11
11
  maximum = collection.map(&:to_s).map(&:length).max
12
- max_lengths.send(:table)[header] = maximum
12
+ (max_lengths.send(:table) rescue max_lengths)[header] = maximum
13
13
  end
14
14
 
15
15
  max_lengths
@@ -17,13 +17,13 @@ module ZTK
17
17
 
18
18
  def calculate_spreadsheet_width(headers, max_lengths)
19
19
  header_lengths = ((headers.count * 3) - 3)
20
- max_length = max_lengths.send(:table).values.reduce(:+)
20
+ max_length = (max_lengths.send(:table) rescue max_lengths).values.reduce(:+)
21
21
  (2 + max_length + header_lengths + 2)
22
22
  end
23
23
 
24
24
  def format_header(headers, lengths)
25
25
  line = headers.collect do |header|
26
- "-" * lengths.send(:table)[header]
26
+ "-" * (lengths.send(:table) rescue lengths)[header]
27
27
  end
28
28
 
29
29
  ["+-", line.join("-+-"), "-+"].join.strip
@@ -49,7 +49,7 @@ module ZTK
49
49
  rows.each do |row|
50
50
  row_line = headers.collect do |header|
51
51
  header_length = max_lengths.send(:table)[header]
52
- content = row.send(:table)[header]
52
+ content = (row.send(:table) rescue row)[header]
53
53
 
54
54
  "%-#{header_length}s" % content
55
55
  end
data/lib/ztk/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module ZTK
2
2
 
3
3
  # ZTK Version String
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
5
5
 
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ztk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zachary Patten
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-15 00:00:00.000000000 Z
11
+ date: 2014-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport