looksee 2.0.0 → 2.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG +6 -0
- data/README.markdown +20 -4
- data/ext/mri/mri.c +16 -20
- data/lib/looksee/JRuby.jar +0 -0
- data/lib/looksee/adapter/base.rb +3 -3
- data/lib/looksee/adapter/rubinius.rb +15 -9
- data/lib/looksee/clean.rb +42 -0
- data/lib/looksee/core_ext.rb +2 -37
- data/lib/looksee/help.rb +1 -1
- data/lib/looksee/rbx.bundle +0 -0
- data/lib/looksee/version.rb +1 -1
- data/spec/{adapter_spec.rb → looksee/adapter_spec.rb} +47 -26
- data/spec/{core_ext_spec.rb → looksee/clean_spec.rb} +8 -8
- data/spec/{columnizer_spec.rb → looksee/columnizer_spec.rb} +0 -0
- data/spec/looksee/core_ext_spec.rb +17 -0
- data/spec/{editor_spec.rb → looksee/editor_spec.rb} +0 -0
- data/spec/{inspector_spec.rb → looksee/inspector_spec.rb} +0 -0
- data/spec/{lookup_path_spec.rb → looksee/lookup_path_spec.rb} +0 -0
- data/spec/{wirble_compatibility_spec.rb → looksee/wirble_compatibility_spec.rb} +0 -0
- data/spec/support/test_adapter.rb +4 -0
- metadata +20 -18
- data/lib/looksee/shortcuts.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d5b5cb3860af73f5d3800d9f580eecafa4c4f6f
|
4
|
+
data.tar.gz: eafb21b450e03a9a1620937aa646013aa3684516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9be481e1b3359c05ec6be675284bf370dc9fecab2c9f42a6c6b81ecf454ed238b243111f48d5d17c1549afaf05cc06c44be4745bb0f64be31bd2de13526762c5
|
7
|
+
data.tar.gz: c146b1c1b04970ae648d561eea58ef80e9cc9b309c8740a2696592284d360ac6ec60a45f7aa342c92dd14a057b0365ba79488b65d3e0c810a6c2d96e9a7a1cb7
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 2.1.0 2014-03-05
|
2
|
+
|
3
|
+
* Add alternative syntax: Looksee[object, *args]. Useful for BasicObject
|
4
|
+
instances, and proxies which delegate #ls via method_missing.
|
5
|
+
* Fix display of origin classes (used when modules are prepended).
|
6
|
+
|
1
7
|
== 2.0.0 2014-01-01
|
2
8
|
|
3
9
|
* Support for MRI 2.1, JRuby 1.7, Rubinius 2.2.
|
data/README.markdown
CHANGED
@@ -115,19 +115,35 @@ Or filter the list by Regexp:
|
|
115
115
|
Array
|
116
116
|
to_a to_ary to_s to_yaml
|
117
117
|
|
118
|
-
|
118
|
+
## Proxy objects
|
119
|
+
|
120
|
+
Objects that delegate everything via `method_missing` to some other object can
|
121
|
+
be tricky, because they will delegate `ls` itself. To view such objects, you can
|
122
|
+
always do:
|
123
|
+
|
124
|
+
Looksee[object]
|
125
|
+
|
126
|
+
This method inspects the object via interpreter extensions, so it works for the
|
127
|
+
most Byzantine object. It will also work for `BasicObject` instances that don't
|
128
|
+
have an `ls` method. `Object#ls` is simply a wrapper around `Looksee.[]`.
|
129
|
+
|
130
|
+
## To the source!
|
131
|
+
|
132
|
+
If you want to know more about any of those methods, Looksee can
|
119
133
|
take you straight to the source in your editor:
|
120
134
|
|
121
|
-
|
135
|
+
[].ls.edit :to_set
|
122
136
|
|
123
137
|
By default, this uses `vi`; customize it like this:
|
124
138
|
|
125
139
|
# %f = file, %l = line number
|
126
140
|
Looksee.editor = "mate -l%l %f"
|
127
141
|
|
128
|
-
|
142
|
+
## Quick Reference
|
143
|
+
|
144
|
+
We've got one:
|
129
145
|
|
130
|
-
|
146
|
+
Looksee.help
|
131
147
|
|
132
148
|
Enjoy!
|
133
149
|
|
data/ext/mri/mri.c
CHANGED
@@ -62,25 +62,6 @@ VALUE Looksee_internal_class(VALUE self, VALUE object) {
|
|
62
62
|
return CLASS_OF(object);
|
63
63
|
}
|
64
64
|
|
65
|
-
/*
|
66
|
-
* Return the class or module that the given internal class
|
67
|
-
* represents.
|
68
|
-
*
|
69
|
-
* If a class is given, this is the class. If an iclass is given,
|
70
|
-
* this is the module it represents in the lookup chain.
|
71
|
-
*/
|
72
|
-
VALUE Looksee_internal_class_to_module(VALUE self, VALUE internal_class) {
|
73
|
-
if (!SPECIAL_CONST_P(internal_class)) {
|
74
|
-
switch (BUILTIN_TYPE(internal_class)) {
|
75
|
-
case T_ICLASS:
|
76
|
-
return RBASIC(internal_class)->klass;
|
77
|
-
case T_CLASS:
|
78
|
-
return internal_class;
|
79
|
-
}
|
80
|
-
}
|
81
|
-
rb_raise(rb_eArgError, "not an internal class: %s", RSTRING_PTR(rb_inspect(internal_class)));
|
82
|
-
}
|
83
|
-
|
84
65
|
#if RUBY_VERSION >= 192
|
85
66
|
|
86
67
|
# define VISIBILITY_TYPE rb_method_flag_t
|
@@ -208,6 +189,15 @@ VALUE Looksee_internal_undefined_instance_methods(VALUE self, VALUE klass) {
|
|
208
189
|
return names;
|
209
190
|
}
|
210
191
|
|
192
|
+
/*
|
193
|
+
* Return true if the given object is an included class or origin class, false
|
194
|
+
* otherwise.
|
195
|
+
*/
|
196
|
+
VALUE Looksee_included_class_p(VALUE self, VALUE object) {
|
197
|
+
return !SPECIAL_CONST_P(object) && BUILTIN_TYPE(object) == T_ICLASS ?
|
198
|
+
Qtrue : Qfalse;
|
199
|
+
}
|
200
|
+
|
211
201
|
VALUE Looksee_singleton_class_p(VALUE self, VALUE object) {
|
212
202
|
return BUILTIN_TYPE(object) == T_CLASS && FL_TEST(object, FL_SINGLETON) ? Qtrue : Qfalse;
|
213
203
|
}
|
@@ -227,6 +217,12 @@ VALUE Looksee_module_name(VALUE self, VALUE module) {
|
|
227
217
|
if (BUILTIN_TYPE(module) == T_CLASS || BUILTIN_TYPE(module) == T_MODULE) {
|
228
218
|
VALUE name = rb_mod_name(module);
|
229
219
|
return name == Qnil ? rb_str_new2("") : name;
|
220
|
+
} else if (BUILTIN_TYPE(module) == T_ICLASS) {
|
221
|
+
VALUE wrapped = RBASIC(module)->klass;
|
222
|
+
VALUE name = Looksee_module_name(self, wrapped);
|
223
|
+
if (BUILTIN_TYPE(wrapped) == T_CLASS)
|
224
|
+
name = rb_str_cat2(name, " (origin)");
|
225
|
+
return name;
|
230
226
|
} else {
|
231
227
|
rb_raise(rb_eTypeError, "expected module, got %s", rb_obj_classname(module));
|
232
228
|
}
|
@@ -291,11 +287,11 @@ void Init_mri(void) {
|
|
291
287
|
VALUE mMRI = rb_define_class_under(mAdapter, "MRI", mBase);
|
292
288
|
rb_define_method(mMRI, "internal_superclass", Looksee_internal_superclass, 1);
|
293
289
|
rb_define_method(mMRI, "internal_class", Looksee_internal_class, 1);
|
294
|
-
rb_define_method(mMRI, "internal_class_to_module", Looksee_internal_class_to_module, 1);
|
295
290
|
rb_define_method(mMRI, "internal_public_instance_methods", Looksee_internal_public_instance_methods, 1);
|
296
291
|
rb_define_method(mMRI, "internal_protected_instance_methods", Looksee_internal_protected_instance_methods, 1);
|
297
292
|
rb_define_method(mMRI, "internal_private_instance_methods", Looksee_internal_private_instance_methods, 1);
|
298
293
|
rb_define_method(mMRI, "internal_undefined_instance_methods", Looksee_internal_undefined_instance_methods, 1);
|
294
|
+
rb_define_method(mMRI, "included_class?", Looksee_included_class_p, 1);
|
299
295
|
rb_define_method(mMRI, "singleton_class?", Looksee_singleton_class_p, 1);
|
300
296
|
rb_define_method(mMRI, "singleton_instance", Looksee_singleton_instance, 1);
|
301
297
|
rb_define_method(mMRI, "module_name", Looksee_module_name, 1);
|
data/lib/looksee/JRuby.jar
CHANGED
Binary file
|
data/lib/looksee/adapter/base.rb
CHANGED
@@ -9,7 +9,7 @@ module Looksee
|
|
9
9
|
modules = []
|
10
10
|
klass = internal_class(object)
|
11
11
|
while klass
|
12
|
-
modules <<
|
12
|
+
modules << klass
|
13
13
|
klass = internal_superclass(klass)
|
14
14
|
end
|
15
15
|
modules
|
@@ -28,7 +28,7 @@ module Looksee
|
|
28
28
|
object = singleton_instance(object)
|
29
29
|
end
|
30
30
|
|
31
|
-
if object.is_a?(Module)
|
31
|
+
if included_class?(mod) || object.is_a?(Module)
|
32
32
|
description = module_name(object)
|
33
33
|
if description.empty?
|
34
34
|
description = "unnamed #{object.is_a?(Class) ? 'Class' : 'Module'}"
|
@@ -52,7 +52,7 @@ module Looksee
|
|
52
52
|
raise NotImplementedError, "abstract"
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
55
|
+
def included_class?(object)
|
56
56
|
raise NotImplementedError, "abstract"
|
57
57
|
end
|
58
58
|
|
@@ -8,27 +8,23 @@ module Looksee
|
|
8
8
|
klass.direct_superclass
|
9
9
|
end
|
10
10
|
|
11
|
-
def internal_class_to_module(internal_class)
|
12
|
-
if internal_class.is_a?(::Rubinius::IncludedModule)
|
13
|
-
internal_class.module
|
14
|
-
else
|
15
|
-
internal_class
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
11
|
def internal_public_instance_methods(mod)
|
12
|
+
return [] if !mod.origin.equal?(mod)
|
20
13
|
mod.method_table.public_names
|
21
14
|
end
|
22
15
|
|
23
16
|
def internal_protected_instance_methods(mod)
|
17
|
+
return [] if !mod.origin.equal?(mod)
|
24
18
|
mod.method_table.protected_names
|
25
19
|
end
|
26
20
|
|
27
21
|
def internal_private_instance_methods(mod)
|
22
|
+
return [] if !mod.origin.equal?(mod)
|
28
23
|
mod.method_table.private_names
|
29
24
|
end
|
30
25
|
|
31
26
|
def internal_undefined_instance_methods(mod)
|
27
|
+
return [] if !mod.origin.equal?(mod)
|
32
28
|
names = []
|
33
29
|
mod.method_table.entries.each do |(name, method, visibility)|
|
34
30
|
names << name if visibility.equal?(:undef)
|
@@ -36,6 +32,10 @@ module Looksee
|
|
36
32
|
names
|
37
33
|
end
|
38
34
|
|
35
|
+
def included_class?(object)
|
36
|
+
object.is_a?(::Rubinius::IncludedModule)
|
37
|
+
end
|
38
|
+
|
39
39
|
def singleton_class?(object)
|
40
40
|
object.is_a?(Class) && !!::Rubinius::Type.singleton_class_object(object)
|
41
41
|
end
|
@@ -50,7 +50,13 @@ module Looksee
|
|
50
50
|
mod.is_a?(Module) or
|
51
51
|
raise TypeError, "expected module, got #{mod.class}"
|
52
52
|
|
53
|
-
if ::Rubinius::
|
53
|
+
if ::Rubinius::IncludedModule === mod
|
54
|
+
if Class === mod.module
|
55
|
+
"#{module_name(mod.module)} (origin)"
|
56
|
+
else
|
57
|
+
module_name(mod.module)
|
58
|
+
end
|
59
|
+
elsif ::Rubinius::Type.respond_to?(:module_name)
|
54
60
|
::Rubinius::Type.module_name(mod) || ''
|
55
61
|
else
|
56
62
|
mod.__name__
|
data/lib/looksee/clean.rb
CHANGED
@@ -90,6 +90,48 @@ module Looksee
|
|
90
90
|
#
|
91
91
|
attr_accessor :ruby_engine
|
92
92
|
|
93
|
+
#
|
94
|
+
# Return a Looksee::Inspector for the given +object+.
|
95
|
+
#
|
96
|
+
# +args+ is an optional list of specifiers.
|
97
|
+
#
|
98
|
+
# * +:public+ - include public methods
|
99
|
+
# * +:protected+ - include public methods
|
100
|
+
# * +:private+ - include public methods
|
101
|
+
# * +:undefined+ - include public methods (see Module#undef_method)
|
102
|
+
# * +:overridden+ - include public methods
|
103
|
+
# * +:nopublic+ - include public methods
|
104
|
+
# * +:noprotected+ - include public methods
|
105
|
+
# * +:noprivate+ - include public methods
|
106
|
+
# * +:noundefined+ - include public methods (see Module#undef_method)
|
107
|
+
# * +:nooverridden+ - include public methods
|
108
|
+
# * a string - only include methods containing this string (may
|
109
|
+
# be used multiple times)
|
110
|
+
# * a regexp - only include methods matching this regexp (may
|
111
|
+
# be used multiple times)
|
112
|
+
#
|
113
|
+
# The default (if options is nil or omitted) is given by
|
114
|
+
# #default_lookup_path_options.
|
115
|
+
#
|
116
|
+
def [](object, *args)
|
117
|
+
options = {:visibilities => Set[], :filters => Set[]}
|
118
|
+
(Looksee.default_specifiers + args).each do |arg|
|
119
|
+
case arg
|
120
|
+
when String, Regexp
|
121
|
+
options[:filters] << arg
|
122
|
+
when :public, :protected, :private, :undefined, :overridden
|
123
|
+
options[:visibilities].add(arg)
|
124
|
+
when :nopublic, :noprotected, :noprivate, :noundefined, :nooverridden
|
125
|
+
visibility = arg.to_s.sub(/\Ano/, '').to_sym
|
126
|
+
options[:visibilities].delete(visibility)
|
127
|
+
else
|
128
|
+
raise ArgumentError, "invalid specifier: #{arg.inspect}"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
lookup_path = LookupPath.new(object)
|
132
|
+
Inspector.new(lookup_path, options)
|
133
|
+
end
|
134
|
+
|
93
135
|
#
|
94
136
|
# Show a quick reference.
|
95
137
|
#
|
data/lib/looksee/core_ext.rb
CHANGED
@@ -1,45 +1,10 @@
|
|
1
1
|
module Looksee
|
2
2
|
module ObjectMixin
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# +args+ is an optional list of specifiers.
|
7
|
-
#
|
8
|
-
# * +:public+ - include public methods
|
9
|
-
# * +:protected+ - include public methods
|
10
|
-
# * +:private+ - include public methods
|
11
|
-
# * +:undefined+ - include public methods (see Module#undef_method)
|
12
|
-
# * +:overridden+ - include public methods
|
13
|
-
# * +:nopublic+ - include public methods
|
14
|
-
# * +:noprotected+ - include public methods
|
15
|
-
# * +:noprivate+ - include public methods
|
16
|
-
# * +:noundefined+ - include public methods (see Module#undef_method)
|
17
|
-
# * +:nooverridden+ - include public methods
|
18
|
-
# * a string - only include methods containing this string (may
|
19
|
-
# be used multiple times)
|
20
|
-
# * a regexp - only include methods matching this regexp (may
|
21
|
-
# be used multiple times)
|
22
|
-
#
|
23
|
-
# The default (if options is nil or omitted) is given by
|
24
|
-
# #default_lookup_path_options.
|
4
|
+
# Shortcut for Looksee[self, *args].
|
25
5
|
#
|
26
6
|
def ls(*args)
|
27
|
-
|
28
|
-
(Looksee.default_specifiers + args).each do |arg|
|
29
|
-
case arg
|
30
|
-
when String, Regexp
|
31
|
-
options[:filters] << arg
|
32
|
-
when :public, :protected, :private, :undefined, :overridden
|
33
|
-
options[:visibilities].add(arg)
|
34
|
-
when :nopublic, :noprotected, :noprivate, :noundefined, :nooverridden
|
35
|
-
visibility = arg.to_s.sub(/\Ano/, '').to_sym
|
36
|
-
options[:visibilities].delete(visibility)
|
37
|
-
else
|
38
|
-
raise ArgumentError, "invalid specifier: #{arg.inspect}"
|
39
|
-
end
|
40
|
-
end
|
41
|
-
lookup_path = LookupPath.new(self)
|
42
|
-
Inspector.new(lookup_path, options)
|
7
|
+
Looksee[self, *args]
|
43
8
|
end
|
44
9
|
|
45
10
|
def self.rename(name) # :nodoc:
|
data/lib/looksee/help.rb
CHANGED
Binary file
|
data/lib/looksee/version.rb
CHANGED
@@ -14,8 +14,9 @@ describe "Looksee.adapter" do
|
|
14
14
|
# of singleton classes, since they have no name.
|
15
15
|
#
|
16
16
|
def filtered_lookup_modules(object)
|
17
|
-
result = @adapter.lookup_modules(object)
|
18
|
-
|
17
|
+
result = @adapter.lookup_modules(object).
|
18
|
+
map { |mod| @adapter.describe_module(mod) }.
|
19
|
+
select{ |description| deterministic_module?(description) }
|
19
20
|
end
|
20
21
|
|
21
22
|
#
|
@@ -25,7 +26,7 @@ describe "Looksee.adapter" do
|
|
25
26
|
# This excludes ruby version dependent modules, and modules tossed
|
26
27
|
# into the hierarchy by testing frameworks.
|
27
28
|
#
|
28
|
-
def deterministic_module?(
|
29
|
+
def deterministic_module?(description)
|
29
30
|
junk_patterns = [
|
30
31
|
# pollution from testing libraries
|
31
32
|
'Mocha', 'Spec',
|
@@ -38,25 +39,10 @@ describe "Looksee.adapter" do
|
|
38
39
|
# something pulls this in under ruby 1.9
|
39
40
|
'PP',
|
40
41
|
# our own pollution,
|
41
|
-
'Looksee::
|
42
|
+
'Looksee::ObjectMixin',
|
42
43
|
]
|
43
|
-
pattern = /\
|
44
|
-
|
45
|
-
# Singleton classes of junk are junk.
|
46
|
-
if Looksee.ruby_engine == 'rbx'
|
47
|
-
# Rubinius singleton class #inspect strings aren't formatted
|
48
|
-
# like the others.
|
49
|
-
while mod.respond_to?(:__metaclass_object__) && (object = mod.__metaclass_object__).is_a?(Class)
|
50
|
-
mod = object
|
51
|
-
end
|
52
|
-
mod.name !~ pattern
|
53
|
-
else
|
54
|
-
name = mod.to_s
|
55
|
-
while name =~ /\A#<Class:(.*)>\z/
|
56
|
-
name = $1
|
57
|
-
end
|
58
|
-
name !~ pattern
|
59
|
-
end
|
44
|
+
pattern = /\b(#{junk_patterns.join('|')})\b/
|
45
|
+
description !~ pattern
|
60
46
|
end
|
61
47
|
|
62
48
|
it "should contain an entry for each module in the object's lookup path" do
|
@@ -67,23 +53,26 @@ describe "Looksee.adapter" do
|
|
67
53
|
include Mod1
|
68
54
|
include Mod2
|
69
55
|
end
|
70
|
-
filtered_lookup_modules(Derived.new) ==
|
56
|
+
filtered_lookup_modules(Derived.new) ==
|
57
|
+
['Derived', 'Mod2', 'Mod1', 'Base', 'Object', 'Kernel']
|
71
58
|
end
|
72
59
|
|
73
60
|
it "should contain an entry for the object's singleton class if it exists" do
|
74
61
|
object = Object.new
|
75
62
|
object.singleton_class
|
76
63
|
|
77
|
-
filtered_lookup_modules(object).should ==
|
64
|
+
filtered_lookup_modules(object).should ==
|
65
|
+
['[Object instance]', 'Object', 'Kernel']
|
78
66
|
end
|
79
67
|
|
80
68
|
it "should contain entries for singleton classes of all ancestors for class objects" do
|
81
69
|
temporary_class :C
|
82
|
-
filtered_lookup_modules(C).should ==
|
70
|
+
filtered_lookup_modules(C).should ==
|
71
|
+
['[C]', '[Object]', 'Class', 'Module', 'Object', 'Kernel']
|
83
72
|
end
|
84
73
|
|
85
74
|
it "should work for immediate objects" do
|
86
|
-
filtered_lookup_modules(1).first.should == Fixnum
|
75
|
+
filtered_lookup_modules(1).first.should == 'Fixnum'
|
87
76
|
end
|
88
77
|
end
|
89
78
|
|
@@ -118,13 +107,27 @@ describe "Looksee.adapter" do
|
|
118
107
|
@adapter.send(target_method, C.singleton_class).to_set.should == Set[:one, :two]
|
119
108
|
end
|
120
109
|
|
121
|
-
# Worth checking as ruby keeps undef'd methods in method tables.
|
122
110
|
it "should not return undefined methods" do
|
123
111
|
temporary_class :C
|
124
112
|
add_methods C, visibility => [:removed]
|
125
113
|
C.send(:undef_method, :removed)
|
126
114
|
@adapter.send(target_method, C).to_set.should == Set[]
|
127
115
|
end
|
116
|
+
|
117
|
+
if RUBY_VERSION >= '2'
|
118
|
+
it "should return methods only for origin classes" do
|
119
|
+
temporary_class :C
|
120
|
+
add_methods C, visibility => :one
|
121
|
+
temporary_module :M
|
122
|
+
add_methods M, visibility => :one
|
123
|
+
C.send(:prepend, M)
|
124
|
+
@adapter.send(target_method, C).should be_empty
|
125
|
+
|
126
|
+
origin = @adapter.lookup_modules(C.new).
|
127
|
+
find { |mod| @adapter.describe_module(mod) == 'C (origin)' }
|
128
|
+
@adapter.send(target_method, origin).should_not be_empty
|
129
|
+
end
|
130
|
+
end
|
128
131
|
end
|
129
132
|
|
130
133
|
def self.it_should_not_list_methods_with_visibility(visibility1, visibility2)
|
@@ -200,6 +203,24 @@ describe "Looksee.adapter" do
|
|
200
203
|
struct_singleton_class = (class << Struct; self; end)
|
201
204
|
@adapter.internal_undefined_instance_methods(struct_singleton_class).should == []
|
202
205
|
end
|
206
|
+
|
207
|
+
if RUBY_VERSION >= '2'
|
208
|
+
it "should return an empty list for non-origin classes" do
|
209
|
+
temporary_class :C
|
210
|
+
C.send(:define_method, :f){}
|
211
|
+
C.send(:undef_method, :f)
|
212
|
+
temporary_module :M
|
213
|
+
M.send(:define_method, :f){}
|
214
|
+
M.send(:undef_method, :f)
|
215
|
+
C.send(:prepend, M)
|
216
|
+
|
217
|
+
@adapter.internal_undefined_instance_methods(C).should be_empty
|
218
|
+
|
219
|
+
origin = @adapter.lookup_modules(C.new).
|
220
|
+
find { |mod| @adapter.describe_module(mod) == 'C (origin)' }
|
221
|
+
@adapter.internal_undefined_instance_methods(origin).should_not be_empty
|
222
|
+
end
|
223
|
+
end
|
203
224
|
end
|
204
225
|
end
|
205
226
|
|
@@ -1,40 +1,40 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Looksee
|
4
|
-
describe "
|
3
|
+
describe Looksee do
|
4
|
+
describe ".[]" do
|
5
5
|
before do
|
6
6
|
@object = Object.new
|
7
7
|
Looksee.stub(:default_specifiers).and_return([:public, :overridden])
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should return an Inspector for the object's lookup path" do
|
11
|
-
result = @object
|
11
|
+
result = Looksee[@object]
|
12
12
|
result.should be_a(Looksee::Inspector)
|
13
13
|
result.lookup_path.object.should.equal?(@object)
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should use Looksee.default_specifiers if no args are given" do
|
17
|
-
@object.
|
17
|
+
Looksee[@object].visibilities.should == Set[:public, :overridden]
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should set visibilities from the given symbols" do
|
21
|
-
inspector = @object
|
21
|
+
inspector = Looksee[@object, :private]
|
22
22
|
inspector.visibilities.should == Set[:public, :overridden, :private]
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should unset visibilities from the given 'no' symbols" do
|
26
|
-
inspector = @object
|
26
|
+
inspector = Looksee[@object, :nooverridden]
|
27
27
|
inspector.visibilities.should == Set[:public]
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should set filters from the given strings and regexp" do
|
31
|
-
inspector = @object
|
31
|
+
inspector = Looksee[@object, 'aa', /bb/]
|
32
32
|
inspector.filters.should == Set['aa', /bb/]
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should raise an ArgumentError if an invalid argument is given" do
|
36
36
|
lambda do
|
37
|
-
@object
|
37
|
+
Looksee[@object, Object.new]
|
38
38
|
end.should raise_error(ArgumentError)
|
39
39
|
end
|
40
40
|
end
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Looksee::ObjectMixin do
|
4
|
+
describe "#ls" do
|
5
|
+
before do
|
6
|
+
@object = Object.new
|
7
|
+
Looksee.stub(:default_specifiers).and_return([])
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should return an Inspector for the object's lookup path using the given arguments" do
|
11
|
+
result = @object.ls(:private)
|
12
|
+
result.should be_a(Looksee::Inspector)
|
13
|
+
result.lookup_path.object.should.equal?(@object)
|
14
|
+
result.visibilities.should == Set[:private]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: looksee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Ogata
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -64,20 +64,21 @@ files:
|
|
64
64
|
- lib/looksee/help.rb
|
65
65
|
- lib/looksee/inspector.rb
|
66
66
|
- lib/looksee/lookup_path.rb
|
67
|
-
- lib/looksee/
|
67
|
+
- lib/looksee/rbx.bundle
|
68
68
|
- lib/looksee/version.rb
|
69
69
|
- lib/looksee/wirble_compatibility.rb
|
70
|
-
- spec/adapter_spec.rb
|
71
|
-
- spec/
|
72
|
-
- spec/
|
73
|
-
- spec/
|
74
|
-
- spec/
|
75
|
-
- spec/
|
70
|
+
- spec/looksee/adapter_spec.rb
|
71
|
+
- spec/looksee/clean_spec.rb
|
72
|
+
- spec/looksee/columnizer_spec.rb
|
73
|
+
- spec/looksee/core_ext_spec.rb
|
74
|
+
- spec/looksee/editor_spec.rb
|
75
|
+
- spec/looksee/inspector_spec.rb
|
76
|
+
- spec/looksee/lookup_path_spec.rb
|
77
|
+
- spec/looksee/wirble_compatibility_spec.rb
|
76
78
|
- spec/spec_helper.rb
|
77
79
|
- spec/support/core_ext.rb
|
78
80
|
- spec/support/temporary_classes.rb
|
79
81
|
- spec/support/test_adapter.rb
|
80
|
-
- spec/wirble_compatibility_spec.rb
|
81
82
|
homepage: http://github.com/oggy/looksee
|
82
83
|
licenses:
|
83
84
|
- MIT
|
@@ -98,19 +99,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
99
|
version: '0'
|
99
100
|
requirements: []
|
100
101
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.2.
|
102
|
+
rubygems_version: 2.2.2
|
102
103
|
signing_key:
|
103
104
|
specification_version: 3
|
104
105
|
summary: Supercharged method introspection in IRB.
|
105
106
|
test_files:
|
106
|
-
- spec/adapter_spec.rb
|
107
|
-
- spec/
|
108
|
-
- spec/
|
109
|
-
- spec/
|
110
|
-
- spec/
|
111
|
-
- spec/
|
107
|
+
- spec/looksee/adapter_spec.rb
|
108
|
+
- spec/looksee/clean_spec.rb
|
109
|
+
- spec/looksee/columnizer_spec.rb
|
110
|
+
- spec/looksee/core_ext_spec.rb
|
111
|
+
- spec/looksee/editor_spec.rb
|
112
|
+
- spec/looksee/inspector_spec.rb
|
113
|
+
- spec/looksee/lookup_path_spec.rb
|
114
|
+
- spec/looksee/wirble_compatibility_spec.rb
|
112
115
|
- spec/spec_helper.rb
|
113
116
|
- spec/support/core_ext.rb
|
114
117
|
- spec/support/temporary_classes.rb
|
115
118
|
- spec/support/test_adapter.rb
|
116
|
-
- spec/wirble_compatibility_spec.rb
|
data/lib/looksee/shortcuts.rb
DELETED