hirb 0.2.6 → 0.2.7

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/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.2.7
2
+ * 2 ruby 1.9 bug fixes.
3
+ * Bug fix in :fields of Hirb::Helpers::ObjectTable.
4
+ * Made :class option in Hirb::Formatter friendlier to external apps.
5
+
1
6
  == 0.2.6
2
7
  * Added :description option and added proc ability to :children_method option for helpers.
3
8
  * Bug fix for no ENV['HOME'] on Windows.
data/README.rdoc CHANGED
@@ -150,7 +150,8 @@ Table code from http://gist.github.com/72234 and {my console
150
150
  app's needs}[http://github.com/cldwalker/tag-tree].
151
151
 
152
152
  == Credits
153
- Chrononaut for vertical table helper.
153
+ * Chrononaut for vertical table helper.
154
+ * crafterm and spastorino for bug fixes.
154
155
 
155
156
  == Bugs/Issues
156
157
  Please report them {on github}[http://github.com/cldwalker/hirb/issues].
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 6
4
+ :patch: 7
@@ -151,7 +151,7 @@ module Hirb
151
151
  end
152
152
 
153
153
  def determine_helper_class(klass)
154
- if klass.is_a?(Symbol) && (helper_class = Helpers.constants.find {|e| e == Util.camelize(klass.to_s)})
154
+ if (helper_class = Helpers.constants.find {|e| e.to_s == Util.camelize(klass.to_s)})
155
155
  klass = "Hirb::Helpers::#{helper_class}"
156
156
  end
157
157
  Util.any_const_get(klass)
@@ -196,4 +196,4 @@ module Hirb
196
196
  end
197
197
  #:startdoc:
198
198
  end
199
- end
199
+ end
@@ -7,7 +7,7 @@ class Hirb::Helpers::ObjectTable < Hirb::Helpers::Table
7
7
  options[:fields] ||= [:to_s]
8
8
  options[:headers] = {:to_s=>'value'} if options[:fields] == [:to_s]
9
9
  rows = [rows] unless rows.is_a?(Array)
10
- item_hashes = rows.inject([]) {|t,item|
10
+ item_hashes = options[:fields].empty? ? [] : rows.inject([]) {|t,item|
11
11
  t << options[:fields].inject({}) {|h,f| h[f] = item.send(f); h}
12
12
  }
13
13
  super(item_hashes, options)
@@ -1,3 +1,4 @@
1
+ module Hirb
1
2
  # Base Table class from which other table classes inherit.
2
3
  # By default, a table is constrained to a default width but this can be adjusted
3
4
  # via the max_width option or Hirb::View.width.
@@ -24,7 +25,6 @@
24
25
  # By default, the fields/columns are the keys of the first hash.
25
26
  #--
26
27
  # derived from http://gist.github.com/72234
27
- module Hirb
28
28
  class Helpers::Table
29
29
  BORDER_LENGTH = 3 # " | " and "-+-" are the borders
30
30
  class TooManyFieldsForWidthError < StandardError; end
@@ -253,4 +253,4 @@ module Hirb
253
253
  end
254
254
  #:startdoc:
255
255
  end
256
- end
256
+ end
@@ -164,7 +164,7 @@ class Hirb::Helpers::Tree
164
164
  def render_parent_characters
165
165
  parent_chars = []
166
166
  get_parents_character(parent_chars)
167
- parent_chars.reverse.map {|level| level + ' ' * 3 }.to_s
167
+ parent_chars.reverse.map {|level| level + ' ' * 3 }.join('')
168
168
  end
169
169
 
170
170
  def get_parents_character(parent_chars)
data/lib/hirb/view.rb CHANGED
@@ -12,7 +12,7 @@ module Hirb
12
12
  # method with Hirb::View.view_output. If using Wirble, you should call this after it. The view configuration
13
13
  # can be specified in a hash via a config file, as options to this method, as this method's block or any combination of these three.
14
14
  # In addition to the config keys mentioned in Hirb, the options also take the following keys:
15
- # Options:
15
+ # ==== Options:
16
16
  # * config_file: Name of config file to read.
17
17
  # * output_method: Specify an object's class and instance method (separated by a period) to be realiased with
18
18
  # hirb's view system. The instance method should take a string to be output. Default is IRB::Irb.output_value
@@ -45,5 +45,12 @@ class Hirb::Helpers::ObjectTableTest < Test::Unit::TestCase
45
45
  TABLE
46
46
  Hirb::Helpers::ObjectTable.render([1,2,3,4]).should == expected_table
47
47
  end
48
- end
48
+
49
+ test "with empty fields" do
50
+ expected_table = <<-TABLE.unindent
51
+ 0 rows in set
52
+ TABLE
53
+ Hirb::Helpers::ObjectTable.render(@pets, :fields => []).should == expected_table
54
+ end
55
+ end
49
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hirb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Horner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-17 00:00:00 -04:00
12
+ date: 2009-10-14 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15