hirb 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 0.4.1
2
+ * Fix bug with rendering empty hash
3
+ * Add missing yaml require
4
+
1
5
  == 0.4.0
2
6
  * Add unicode table helper thanks to janlelis
3
7
  * Make pager compatible with full width characters
@@ -1,6 +1,7 @@
1
1
  # Needed by Hirb::String to handle multibyte characters
2
2
  $KCODE = 'u' if RUBY_VERSION < '1.9'
3
3
 
4
+ require 'yaml'
4
5
  require 'hirb/util'
5
6
  require 'hirb/string'
6
7
  require 'hirb/formatter' # must come before helpers/auto_table
@@ -78,4 +79,4 @@ module Hirb
78
79
  end
79
80
  #:startdoc:
80
81
  end
81
- end
82
+ end
@@ -75,8 +75,8 @@ class Hirb::Helpers::Table
75
75
  end
76
76
 
77
77
  def sum(arr)
78
- arr.inject {|t,e| t += e }
78
+ arr.inject {|t,e| t += e } || 0
79
79
  end
80
80
  #:startdoc:
81
81
  end
82
- end
82
+ end
@@ -1,3 +1,3 @@
1
1
  module Hirb
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
@@ -178,7 +178,7 @@ module Hirb
178
178
  if defined? Ripl
179
179
  @output_method = true
180
180
  require 'ripl/hirb'
181
- elsif defined? IRB
181
+ elsif defined? IRB::Irb
182
182
  @output_method = true
183
183
  ::IRB::Irb.class_eval do
184
184
  alias_method :non_hirb_view_output, :output_value
@@ -190,7 +190,7 @@ module Hirb
190
190
  end
191
191
 
192
192
  def disable_output_method
193
- if defined?(IRB) && !defined? Ripl
193
+ if defined?(IRB::Irb) && !defined? Ripl
194
194
  ::IRB::Irb.send :alias_method, :output_value, :non_hirb_view_output
195
195
  end
196
196
  @output_method = nil
@@ -54,6 +54,18 @@ describe "Table" do
54
54
  table([{'a'=>1, 'b'=>2}, {'a'=>3, 'b'=>4}]).should == expected_table
55
55
  end
56
56
 
57
+ it "with no keys renders" do
58
+ expected_table = <<-TABLE.unindent
59
+ +--+
60
+ | |
61
+ +--+
62
+ | |
63
+ +--+
64
+ 1 row in set
65
+ TABLE
66
+ table([{}]).should == expected_table
67
+ end
68
+
57
69
  it "with array only rows renders" do
58
70
  expected_table = <<-TABLE.unindent
59
71
  +---+---+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hirb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Gabriel Horner
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-22 00:00:00 -05:00
18
+ date: 2011-03-26 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency