looksee 0.1.0 → 0.2.1
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/History.txt +9 -1
- data/README.rdoc +11 -1
- data/lib/looksee.rb +16 -12
- data/lib/looksee/shortcuts.rb +53 -0
- data/lib/looksee/version.rb +1 -1
- data/lib/looksee/wirble_compatibility.rb +2 -1
- data/looksee.gemspec +3 -3
- data/script/console +4 -7
- metadata +3 -3
data/History.txt
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
== 0.2.1 2009-08-30
|
|
2
|
+
|
|
3
|
+
* Updated history.
|
|
4
|
+
|
|
5
|
+
== 0.2.0 2009-08-30
|
|
6
|
+
|
|
7
|
+
* Add Looksee.help for printing a quick reference. [Brian Morearty]
|
|
8
|
+
|
|
1
9
|
== 0.1.0 2009-08-20
|
|
2
10
|
|
|
3
11
|
* Add methods undefined with Module#undef_method. Blue by default.
|
|
@@ -7,7 +15,7 @@
|
|
|
7
15
|
* Added #grep to filter methods shown: lp(object).grep(/pattern/)
|
|
8
16
|
* Fix #1: Play nice with Wirble.
|
|
9
17
|
* Fix #3: Don't die when examining immediate objects (fixnum, symbol,
|
|
10
|
-
true, false, nil)
|
|
18
|
+
true, false, nil) [Leonard Chin]
|
|
11
19
|
|
|
12
20
|
== 0.0.1 2009-07-05
|
|
13
21
|
|
data/README.rdoc
CHANGED
|
@@ -66,7 +66,13 @@ This defines a method +lp+ ("lookup path") which lets you do:
|
|
|
66
66
|
|
|
67
67
|
It'll also color the methods according to whether they're public,
|
|
68
68
|
protected, private, undefined (using Module#undef_method), or
|
|
69
|
-
overridden. So pretty.
|
|
69
|
+
overridden. So pretty. The default colors are:
|
|
70
|
+
|
|
71
|
+
public: green
|
|
72
|
+
protected: yellow
|
|
73
|
+
private: red
|
|
74
|
+
undefined: blue
|
|
75
|
+
overridden: black
|
|
70
76
|
|
|
71
77
|
By default, it shows public and protected methods. Add private ones
|
|
72
78
|
like so:
|
|
@@ -83,6 +89,10 @@ use it as a library without polluting the built-in classes. See:
|
|
|
83
89
|
|
|
84
90
|
$ ri Looksee
|
|
85
91
|
|
|
92
|
+
Or do this in IRB for a quick reference:
|
|
93
|
+
|
|
94
|
+
Looksee.help
|
|
95
|
+
|
|
86
96
|
Enjoy!
|
|
87
97
|
|
|
88
98
|
== INSTALL
|
data/lib/looksee.rb
CHANGED
|
@@ -46,6 +46,10 @@ require "looksee/version"
|
|
|
46
46
|
# require 'looksee'
|
|
47
47
|
# Looksee.lookup_path(thing) # like "lp thing"
|
|
48
48
|
#
|
|
49
|
+
# For a quick reference:
|
|
50
|
+
#
|
|
51
|
+
# Looksee.help
|
|
52
|
+
#
|
|
49
53
|
# == Configuration
|
|
50
54
|
#
|
|
51
55
|
# Set these:
|
|
@@ -116,12 +120,12 @@ module Looksee
|
|
|
116
120
|
# Default:
|
|
117
121
|
#
|
|
118
122
|
# {
|
|
119
|
-
# :module => "\e[1;37m%s\e[0m",
|
|
120
|
-
# :public => "\e[1;32m%s\e[0m",
|
|
121
|
-
# :protected => "\e[1;33m%s\e[0m",
|
|
122
|
-
# :private => "\e[1;31m%s\e[0m",
|
|
123
|
-
# :undefined => "\e[1;34m%s\e[0m",
|
|
124
|
-
# :overridden => "\e[1;30m%s\e[0m",
|
|
123
|
+
# :module => "\e[1;37m%s\e[0m", # white
|
|
124
|
+
# :public => "\e[1;32m%s\e[0m", # green
|
|
125
|
+
# :protected => "\e[1;33m%s\e[0m", # yellow
|
|
126
|
+
# :private => "\e[1;31m%s\e[0m", # red
|
|
127
|
+
# :undefined => "\e[1;34m%s\e[0m", # blue
|
|
128
|
+
# :overridden => "\e[1;30m%s\e[0m", # black
|
|
125
129
|
# }
|
|
126
130
|
#
|
|
127
131
|
attr_accessor :styles
|
|
@@ -144,12 +148,12 @@ module Looksee
|
|
|
144
148
|
self.default_lookup_path_options = {:public => true, :protected => true, :undefined => true, :overridden => true}
|
|
145
149
|
self.default_width = 80
|
|
146
150
|
self.styles = {
|
|
147
|
-
:module => "\e[1;37m%s\e[0m",
|
|
148
|
-
:public => "\e[1;32m%s\e[0m",
|
|
149
|
-
:protected => "\e[1;33m%s\e[0m",
|
|
150
|
-
:private => "\e[1;31m%s\e[0m",
|
|
151
|
-
:undefined => "\e[1;34m%s\e[0m",
|
|
152
|
-
:overridden => "\e[1;30m%s\e[0m",
|
|
151
|
+
:module => "\e[1;37m%s\e[0m", # white
|
|
152
|
+
:public => "\e[1;32m%s\e[0m", # green
|
|
153
|
+
:protected => "\e[1;33m%s\e[0m", # yellow
|
|
154
|
+
:private => "\e[1;31m%s\e[0m", # red
|
|
155
|
+
:undefined => "\e[1;34m%s\e[0m", # blue
|
|
156
|
+
:overridden => "\e[1;30m%s\e[0m", # black
|
|
153
157
|
}
|
|
154
158
|
|
|
155
159
|
class LookupPath
|
data/lib/looksee/shortcuts.rb
CHANGED
|
@@ -52,3 +52,56 @@ class Object
|
|
|
52
52
|
self
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
|
+
|
|
56
|
+
module Looksee
|
|
57
|
+
#
|
|
58
|
+
# Show a quick reference.
|
|
59
|
+
#
|
|
60
|
+
def self.help
|
|
61
|
+
Help.new
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
class Help
|
|
65
|
+
def inspect
|
|
66
|
+
<<-EOS.gsub(/^ *\|/, '')
|
|
67
|
+
|== Looksee Quick Reference
|
|
68
|
+
|
|
|
69
|
+
| lp(object)
|
|
70
|
+
| object.lookup_path
|
|
71
|
+
| Print the method lookup path of \`object\'
|
|
72
|
+
|
|
|
73
|
+
| lpi(klass)
|
|
74
|
+
| Print the method lookup path of an instance of \`klass\'.
|
|
75
|
+
|
|
|
76
|
+
|Add .grep(/pattern/) to restrict the methods listed:
|
|
77
|
+
|
|
|
78
|
+
| lp(object).grep(/foo/)
|
|
79
|
+
|
|
|
80
|
+
|== Visibilities
|
|
81
|
+
|
|
|
82
|
+
|Methods are printed according to their visibility:
|
|
83
|
+
|
|
|
84
|
+
|#{style_info}
|
|
85
|
+
|
|
|
86
|
+
|Pass options to specify which visibilities to show:
|
|
87
|
+
|
|
|
88
|
+
| lp(object, :private => true, :overridden => false)
|
|
89
|
+
| lp(object, :private , :overridden => false) # shortcut
|
|
90
|
+
EOS
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def style_info
|
|
94
|
+
max_width = 0
|
|
95
|
+
styles = [:public, :protected, :private, :undefined, :overridden]
|
|
96
|
+
data = styles.map do |name|
|
|
97
|
+
display_style = Looksee.styles[name] % name
|
|
98
|
+
display_length = display_style.length
|
|
99
|
+
max_width = display_length if display_length > max_width
|
|
100
|
+
on = Looksee.default_lookup_path_options[name] ? 'on' : 'off'
|
|
101
|
+
[display_style, on]
|
|
102
|
+
end.map do |display_style, on|
|
|
103
|
+
" * #{display_style.ljust(max_width)} (#{on} by default)"
|
|
104
|
+
end.join("\n")
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
data/lib/looksee/version.rb
CHANGED
|
@@ -38,7 +38,8 @@ module Looksee
|
|
|
38
38
|
def hook_into_irb_output_value
|
|
39
39
|
IRB::Irb.class_eval do
|
|
40
40
|
def output_value_with_looksee
|
|
41
|
-
|
|
41
|
+
case @context.last_value
|
|
42
|
+
when Looksee::LookupPath, Looksee::Help
|
|
42
43
|
non_color_output_value
|
|
43
44
|
else
|
|
44
45
|
output_value_without_looksee
|
data/looksee.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{looksee}
|
|
5
|
-
s.version = "0.1
|
|
5
|
+
s.version = "0.2.1"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["George Ogata"]
|
|
9
|
-
s.date = %q{2009-08-
|
|
9
|
+
s.date = %q{2009-08-30}
|
|
10
10
|
s.description = %q{Looksee lets you examine the method lookup path of objects in ways not
|
|
11
11
|
possible in plain ruby.}
|
|
12
12
|
s.email = ["george.ogata@gmail.com"]
|
|
@@ -17,7 +17,7 @@ possible in plain ruby.}
|
|
|
17
17
|
s.rdoc_options = ["--main", "README.rdoc"]
|
|
18
18
|
s.require_paths = ["lib", "ext/looksee"]
|
|
19
19
|
s.rubyforge_project = %q{looksee}
|
|
20
|
-
s.rubygems_version = %q{1.3.
|
|
20
|
+
s.rubygems_version = %q{1.3.5}
|
|
21
21
|
s.summary = %q{Looksee lets you examine the method lookup path of objects in ways not possible in plain ruby.}
|
|
22
22
|
|
|
23
23
|
if s.respond_to? :specification_version then
|
data/script/console
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# File: script/console
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
libs = " -r irb/completion"
|
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/looksee.rb'}"
|
|
3
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
|
4
|
+
require 'irb'
|
|
9
5
|
puts "Loading looksee gem"
|
|
10
|
-
|
|
6
|
+
require 'looksee/shortcuts'
|
|
7
|
+
IRB.start
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: looksee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- George Ogata
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-08-
|
|
12
|
+
date: 2009-08-30 00:00:00 -04:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
112
112
|
requirements: []
|
|
113
113
|
|
|
114
114
|
rubyforge_project: looksee
|
|
115
|
-
rubygems_version: 1.3.
|
|
115
|
+
rubygems_version: 1.3.5
|
|
116
116
|
signing_key:
|
|
117
117
|
specification_version: 3
|
|
118
118
|
summary: Looksee lets you examine the method lookup path of objects in ways not possible in plain ruby.
|