hirb 0.4.5 → 0.5.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/.gemspec +2 -2
- data/CHANGELOG.rdoc +3 -0
- data/README.rdoc +3 -5
- data/lib/bond/completions/hirb.rb +1 -1
- data/lib/hirb/helpers/table.rb +2 -0
- data/lib/hirb/version.rb +1 -1
- data/test/deps.rip +2 -2
- data/test/table_test.rb +24 -0
- metadata +5 -5
data/.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.required_rubygems_version = ">= 1.3.5"
|
14
14
|
s.rubyforge_project = 'tagaholic'
|
15
15
|
s.add_development_dependency 'bacon', '>= 1.1.0'
|
16
|
-
s.add_development_dependency 'mocha'
|
17
|
-
s.add_development_dependency 'mocha-on-bacon'
|
16
|
+
s.add_development_dependency 'mocha', '>= 0.9.8'
|
17
|
+
s.add_development_dependency 'mocha-on-bacon', '>= 0.1.1'
|
18
18
|
s.add_development_dependency 'bacon-bits'
|
19
19
|
s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
|
20
20
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
|
data/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -185,12 +185,10 @@ Table code from http://gist.github.com/72234 and {my console app's needs}[http:/
|
|
185
185
|
== Bugs/Issues
|
186
186
|
Please report them {on github}[http://github.com/cldwalker/hirb/issues].
|
187
187
|
|
188
|
+
== Contributing
|
189
|
+
{See here}[http://tagaholic.me/contributing.html]
|
190
|
+
|
188
191
|
== Links
|
189
192
|
* http://tagaholic.me/2009/03/13/hirb-irb-on-the-good-stuff.html
|
190
193
|
* http://tagaholic.me/2009/03/18/ruby-class-trees-rails-plugin-trees-with-hirb.html
|
191
194
|
* http://tagaholic.me/2009/06/19/page-irb-output-and-improve-ri-with-hirb.html
|
192
|
-
|
193
|
-
== Todo
|
194
|
-
* Consider generating views based on methods an object responds to.
|
195
|
-
* Provide helper methods to all views.
|
196
|
-
* Consider adding a template helper.
|
@@ -4,7 +4,7 @@ complete(:methods=>%w{Hirb::View.enable Hirb.enable}) {
|
|
4
4
|
complete(:methods=>%w{Hirb::Helpers::Table.render table}) {
|
5
5
|
%w{fields headers max_fields max_width resize number change_fields}+
|
6
6
|
%w{filters header_filter filter_any filter_classes vertical all_fields}+
|
7
|
-
%w{description escape_special_chars table_class hide_empty unicode}
|
7
|
+
%w{description escape_special_chars table_class hide_empty unicode grep_fields}
|
8
8
|
}
|
9
9
|
complete(:method=>"Hirb::Helpers::Tree.render") {
|
10
10
|
%w{type validate indent limit description multi_line_nodes value_method children_method}
|
data/lib/hirb/helpers/table.rb
CHANGED
@@ -88,6 +88,7 @@ module Hirb
|
|
88
88
|
# [*:number*] When set to true, numbers rows by adding a :hirb_number column as the first column. Default is false.
|
89
89
|
# [*:change_fields*] A hash to change old field names to new field names. This can also be an array of new names but only for array rows.
|
90
90
|
# This is useful when wanting to change auto-generated keys to more user-friendly names i.e. for array rows.
|
91
|
+
# [*:grep_fields*] A regexp that selects which fields to display. By default this is not set and applied.
|
91
92
|
# [*:filters*] A hash of fields and their filters, applied to every row in a field. A filter can be a proc, an instance method
|
92
93
|
# applied to the field value or a Filters method. Also see the filter_classes attribute below.
|
93
94
|
# [*:header_filter*] A filter, like one in :filters, that is applied to all headers after the :headers option.
|
@@ -140,6 +141,7 @@ module Hirb
|
|
140
141
|
@options = {:description=>true, :filters=>{}, :change_fields=>{}, :escape_special_chars=>true,
|
141
142
|
:filter_any=>Helpers::Table.filter_any, :resize=>true}.merge(options)
|
142
143
|
@fields = set_fields(rows)
|
144
|
+
@fields = @fields.select {|e| e.to_s[@options[:grep_fields]] } if @options[:grep_fields]
|
143
145
|
@rows = set_rows(rows)
|
144
146
|
@headers = set_headers
|
145
147
|
if @options[:number]
|
data/lib/hirb/version.rb
CHANGED
data/test/deps.rip
CHANGED
data/test/table_test.rb
CHANGED
@@ -194,6 +194,30 @@ describe "Table" do
|
|
194
194
|
table([{:a=>1, :b=>2}, {:a=>3, :b=>4}], :fields=>[:b, :c]).should == expected_table
|
195
195
|
end
|
196
196
|
|
197
|
+
it "grep_fields option and symbol fields" do
|
198
|
+
expected_table = <<-TABLE.unindent
|
199
|
+
+----+----+
|
200
|
+
| f1 | f2 |
|
201
|
+
+----+----+
|
202
|
+
| 1 | 2 |
|
203
|
+
+----+----+
|
204
|
+
1 row in set
|
205
|
+
TABLE
|
206
|
+
table([{:f1 => 1, :f2 => 2, :gf1 => 3}], :grep_fields => /^f/).should == expected_table
|
207
|
+
end
|
208
|
+
|
209
|
+
it "grep_fields option and non-symbol fields" do
|
210
|
+
expected_table = <<-TABLE.unindent
|
211
|
+
+---+
|
212
|
+
| 1 |
|
213
|
+
+---+
|
214
|
+
| 2 |
|
215
|
+
+---+
|
216
|
+
1 row in set
|
217
|
+
TABLE
|
218
|
+
table([[1,2,3]], :grep_fields => /1/).should == expected_table
|
219
|
+
end
|
220
|
+
|
197
221
|
it "invalid field in max_fields option renders" do
|
198
222
|
expected_table = <<-TABLE.unindent
|
199
223
|
+------------+---+
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: hirb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.5.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Gabriel Horner
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-08-06 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 0.9.8
|
36
36
|
type: :development
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version:
|
46
|
+
version: 0.1.1
|
47
47
|
type: :development
|
48
48
|
version_requirements: *id003
|
49
49
|
- !ruby/object:Gem::Dependency
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
requirements: []
|
143
143
|
|
144
144
|
rubyforge_project: tagaholic
|
145
|
-
rubygems_version: 1.6.
|
145
|
+
rubygems_version: 1.6.2
|
146
146
|
signing_key:
|
147
147
|
specification_version: 3
|
148
148
|
summary: A mini view framework for console/irb that's easy to use, even while under its influence.
|