looksee 0.2.1 → 1.0.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/CHANGELOG +14 -0
- data/LICENSE +22 -0
- data/README.markdown +161 -0
- data/Rakefile +9 -36
- data/ext/extconf.rb +9 -0
- data/ext/mri/1.9.2/debug.h +36 -0
- data/ext/mri/1.9.2/id.h +170 -0
- data/ext/mri/1.9.2/method.h +103 -0
- data/ext/mri/1.9.2/node.h +483 -0
- data/ext/mri/1.9.2/thread_pthread.h +27 -0
- data/ext/mri/1.9.2/vm_core.h +707 -0
- data/ext/mri/1.9.2/vm_opts.h +51 -0
- data/ext/mri/env-1.8.h +27 -0
- data/ext/mri/eval_c-1.8.h +27 -0
- data/ext/mri/mri.c +269 -0
- data/ext/{looksee → mri}/node-1.9.h +0 -0
- data/ext/rbx/rbx.c +13 -0
- data/lib/looksee.rb +4 -385
- data/lib/looksee/adapter.rb +10 -0
- data/lib/looksee/adapter/base.rb +100 -0
- data/lib/looksee/adapter/rubinius.rb +73 -0
- data/lib/looksee/clean.rb +122 -0
- data/lib/looksee/columnizer.rb +73 -0
- data/lib/looksee/core_ext.rb +59 -0
- data/lib/looksee/editor.rb +58 -0
- data/lib/looksee/help.rb +54 -0
- data/lib/looksee/inspector.rb +55 -0
- data/lib/looksee/lookup_path.rb +95 -0
- data/lib/looksee/rbx.bundle +0 -0
- data/lib/looksee/shortcuts.rb +1 -105
- data/lib/looksee/version.rb +9 -1
- data/lib/looksee/wirble_compatibility.rb +2 -3
- data/spec/adapter_spec.rb +546 -0
- data/spec/columnizer_spec.rb +52 -0
- data/spec/core_ext_spec.rb +41 -0
- data/spec/editor_spec.rb +128 -0
- data/spec/inspector_spec.rb +178 -0
- data/spec/lookup_path_spec.rb +84 -0
- data/spec/spec_helper.rb +13 -127
- data/spec/support/core_ext.rb +25 -0
- data/spec/support/temporary_classes.rb +102 -0
- data/spec/support/test_adapter.rb +72 -0
- data/spec/wirble_compatibility_spec.rb +20 -23
- metadata +91 -57
- data/.autotest +0 -9
- data/History.txt +0 -22
- data/Manifest.txt +0 -21
- data/README.rdoc +0 -129
- data/ext/looksee/extconf.rb +0 -6
- data/ext/looksee/looksee.c +0 -144
- data/looksee.gemspec +0 -44
- data/script/console +0 -7
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/looksee_spec.rb +0 -425
- data/tasks/extconf.rake +0 -13
- data/tasks/extconf/looksee.rake +0 -43
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: looksee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- George Ogata
|
@@ -9,112 +10,145 @@ autorequire:
|
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
+
date: 2011-03-09 00:00:00 -05:00
|
13
14
|
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
name: ritual
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
20
21
|
requirements:
|
21
22
|
- - ">="
|
22
23
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
|
24
|
+
version: 0.2.0
|
25
|
+
type: :development
|
26
|
+
version_requirements: *id001
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rspec
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
30
32
|
requirements:
|
31
33
|
- - ">="
|
32
34
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
|
35
|
+
version: 2.0.0
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id002
|
35
38
|
- !ruby/object:Gem::Dependency
|
36
39
|
name: mocha
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
40
43
|
requirements:
|
41
44
|
- - ">="
|
42
45
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0
|
44
|
-
version:
|
45
|
-
- !ruby/object:Gem::Dependency
|
46
|
-
name: hoe
|
46
|
+
version: "0"
|
47
47
|
type: :development
|
48
|
-
|
49
|
-
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: wirble
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
50
54
|
requirements:
|
51
55
|
- - ">="
|
52
56
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
possible in plain ruby.
|
57
|
+
version: "0"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
60
|
+
description:
|
58
61
|
email:
|
59
62
|
- george.ogata@gmail.com
|
60
63
|
executables: []
|
61
64
|
|
62
65
|
extensions:
|
63
|
-
- ext/
|
66
|
+
- ext/extconf.rb
|
64
67
|
extra_rdoc_files:
|
65
|
-
-
|
66
|
-
-
|
68
|
+
- CHANGELOG
|
69
|
+
- LICENSE
|
70
|
+
- README.markdown
|
67
71
|
files:
|
68
|
-
- .
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
-
|
76
|
-
- lib/looksee.rb
|
72
|
+
- lib/looksee/adapter/base.rb
|
73
|
+
- lib/looksee/adapter/rubinius.rb
|
74
|
+
- lib/looksee/adapter.rb
|
75
|
+
- lib/looksee/clean.rb
|
76
|
+
- lib/looksee/columnizer.rb
|
77
|
+
- lib/looksee/core_ext.rb
|
78
|
+
- lib/looksee/editor.rb
|
79
|
+
- lib/looksee/help.rb
|
80
|
+
- lib/looksee/inspector.rb
|
81
|
+
- lib/looksee/lookup_path.rb
|
82
|
+
- lib/looksee/rbx.bundle
|
77
83
|
- lib/looksee/shortcuts.rb
|
78
84
|
- lib/looksee/version.rb
|
79
85
|
- lib/looksee/wirble_compatibility.rb
|
80
|
-
- looksee.
|
81
|
-
-
|
82
|
-
-
|
83
|
-
-
|
84
|
-
-
|
86
|
+
- lib/looksee.rb
|
87
|
+
- ext/mri/mri.c
|
88
|
+
- ext/rbx/rbx.c
|
89
|
+
- ext/mri/1.9.2/debug.h
|
90
|
+
- ext/mri/1.9.2/id.h
|
91
|
+
- ext/mri/1.9.2/method.h
|
92
|
+
- ext/mri/1.9.2/node.h
|
93
|
+
- ext/mri/1.9.2/thread_pthread.h
|
94
|
+
- ext/mri/1.9.2/vm_core.h
|
95
|
+
- ext/mri/1.9.2/vm_opts.h
|
96
|
+
- ext/mri/env-1.8.h
|
97
|
+
- ext/mri/eval_c-1.8.h
|
98
|
+
- ext/mri/node-1.9.h
|
99
|
+
- ext/extconf.rb
|
100
|
+
- CHANGELOG
|
101
|
+
- LICENSE
|
102
|
+
- Rakefile
|
103
|
+
- README.markdown
|
104
|
+
- spec/adapter_spec.rb
|
105
|
+
- spec/columnizer_spec.rb
|
106
|
+
- spec/core_ext_spec.rb
|
107
|
+
- spec/editor_spec.rb
|
108
|
+
- spec/inspector_spec.rb
|
109
|
+
- spec/lookup_path_spec.rb
|
85
110
|
- spec/spec_helper.rb
|
111
|
+
- spec/support/core_ext.rb
|
112
|
+
- spec/support/temporary_classes.rb
|
113
|
+
- spec/support/test_adapter.rb
|
86
114
|
- spec/wirble_compatibility_spec.rb
|
87
|
-
- tasks/extconf.rake
|
88
|
-
- tasks/extconf/looksee.rake
|
89
115
|
has_rdoc: true
|
90
116
|
homepage: http://github.com/oggy/looksee
|
91
117
|
licenses: []
|
92
118
|
|
93
119
|
post_install_message:
|
94
|
-
rdoc_options:
|
95
|
-
|
96
|
-
- README.rdoc
|
120
|
+
rdoc_options: []
|
121
|
+
|
97
122
|
require_paths:
|
98
123
|
- lib
|
99
|
-
- ext/looksee
|
100
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
101
126
|
requirements:
|
102
127
|
- - ">="
|
103
128
|
- !ruby/object:Gem::Version
|
104
129
|
version: "0"
|
105
|
-
version:
|
106
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
107
132
|
requirements:
|
108
133
|
- - ">="
|
109
134
|
- !ruby/object:Gem::Version
|
110
135
|
version: "0"
|
111
|
-
version:
|
112
136
|
requirements: []
|
113
137
|
|
114
|
-
rubyforge_project:
|
115
|
-
rubygems_version: 1.
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 1.5.2
|
116
140
|
signing_key:
|
117
141
|
specification_version: 3
|
118
|
-
summary:
|
119
|
-
test_files:
|
120
|
-
|
142
|
+
summary: Supercharged method introspection in IRB.
|
143
|
+
test_files:
|
144
|
+
- spec/adapter_spec.rb
|
145
|
+
- spec/columnizer_spec.rb
|
146
|
+
- spec/core_ext_spec.rb
|
147
|
+
- spec/editor_spec.rb
|
148
|
+
- spec/inspector_spec.rb
|
149
|
+
- spec/lookup_path_spec.rb
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
- spec/support/core_ext.rb
|
152
|
+
- spec/support/temporary_classes.rb
|
153
|
+
- spec/support/test_adapter.rb
|
154
|
+
- spec/wirble_compatibility_spec.rb
|
data/.autotest
DELETED
data/History.txt
DELETED
@@ -1,22 +0,0 @@
|
|
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
|
-
|
9
|
-
== 0.1.0 2009-08-20
|
10
|
-
|
11
|
-
* Add methods undefined with Module#undef_method. Blue by default.
|
12
|
-
|
13
|
-
== 0.0.2 2009-07-28
|
14
|
-
|
15
|
-
* Added #grep to filter methods shown: lp(object).grep(/pattern/)
|
16
|
-
* Fix #1: Play nice with Wirble.
|
17
|
-
* Fix #3: Don't die when examining immediate objects (fixnum, symbol,
|
18
|
-
true, false, nil) [Leonard Chin]
|
19
|
-
|
20
|
-
== 0.0.1 2009-07-05
|
21
|
-
|
22
|
-
* Hi.
|
data/Manifest.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
.autotest
|
2
|
-
History.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.rdoc
|
5
|
-
Rakefile
|
6
|
-
ext/looksee/extconf.rb
|
7
|
-
ext/looksee/looksee.c
|
8
|
-
ext/looksee/node-1.9.h
|
9
|
-
lib/looksee.rb
|
10
|
-
lib/looksee/shortcuts.rb
|
11
|
-
lib/looksee/version.rb
|
12
|
-
lib/looksee/wirble_compatibility.rb
|
13
|
-
looksee.gemspec
|
14
|
-
script/console
|
15
|
-
script/destroy
|
16
|
-
script/generate
|
17
|
-
spec/looksee_spec.rb
|
18
|
-
spec/spec_helper.rb
|
19
|
-
spec/wirble_compatibility_spec.rb
|
20
|
-
tasks/extconf.rake
|
21
|
-
tasks/extconf/looksee.rake
|
data/README.rdoc
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
= Looksee
|
2
|
-
|
3
|
-
* http://github.com/oggy/looksee
|
4
|
-
|
5
|
-
== DESCRIPTION
|
6
|
-
|
7
|
-
Looksee lets you examine the method lookup path of objects in ways not
|
8
|
-
possible in plain ruby.
|
9
|
-
|
10
|
-
== SYNOPSIS
|
11
|
-
|
12
|
-
Pop this in your .irbrc :
|
13
|
-
|
14
|
-
require 'looksee/shortcuts'
|
15
|
-
|
16
|
-
This defines a method +lp+ ("lookup path") which lets you do:
|
17
|
-
|
18
|
-
irb(main):001:0> lp []
|
19
|
-
=> Array
|
20
|
-
& concat frozen? push taguri
|
21
|
-
* count hash rassoc taguri=
|
22
|
-
+ cycle include? reject take
|
23
|
-
- delete index reject! take_while
|
24
|
-
<< delete_at indexes replace to_a
|
25
|
-
<=> delete_if indices reverse to_ary
|
26
|
-
== drop insert reverse! to_s
|
27
|
-
[] drop_while inspect reverse_each to_yaml
|
28
|
-
[]= each join rindex transpose
|
29
|
-
assoc each_index last select uniq
|
30
|
-
at empty? length shift uniq!
|
31
|
-
choice eql? map shuffle unshift
|
32
|
-
clear fetch map! shuffle! values_at
|
33
|
-
collect fill nitems size yaml_initialize
|
34
|
-
collect! find_index pack slice zip
|
35
|
-
combination first permutation slice! |
|
36
|
-
compact flatten pop sort
|
37
|
-
compact! flatten! product sort!
|
38
|
-
Enumerable
|
39
|
-
all? each_slice first min reverse_each
|
40
|
-
any? each_with_index grep min_by select
|
41
|
-
collect entries group_by minmax sort
|
42
|
-
count enum_cons include? minmax_by sort_by
|
43
|
-
cycle enum_slice inject none? take
|
44
|
-
detect enum_with_index map one? take_while
|
45
|
-
drop find max partition to_a
|
46
|
-
drop_while find_all max_by reduce zip
|
47
|
-
each_cons find_index member? reject
|
48
|
-
Object
|
49
|
-
taguri taguri= to_yaml to_yaml_properties to_yaml_style
|
50
|
-
Kernel
|
51
|
-
== hash object_id
|
52
|
-
=== id private_methods
|
53
|
-
=~ inspect protected_methods
|
54
|
-
__id__ instance_eval public_methods
|
55
|
-
__send__ instance_exec respond_to?
|
56
|
-
class instance_of? send
|
57
|
-
clone instance_variable_defined? singleton_methods
|
58
|
-
display instance_variable_get taint
|
59
|
-
dup instance_variable_set tainted?
|
60
|
-
enum_for instance_variables tap
|
61
|
-
eql? is_a? to_a
|
62
|
-
equal? kind_of? to_enum
|
63
|
-
extend method to_s
|
64
|
-
freeze methods type
|
65
|
-
frozen? nil? untaint
|
66
|
-
|
67
|
-
It'll also color the methods according to whether they're public,
|
68
|
-
protected, private, undefined (using Module#undef_method), or
|
69
|
-
overridden. So pretty. The default colors are:
|
70
|
-
|
71
|
-
public: green
|
72
|
-
protected: yellow
|
73
|
-
private: red
|
74
|
-
undefined: blue
|
75
|
-
overridden: black
|
76
|
-
|
77
|
-
By default, it shows public and protected methods. Add private ones
|
78
|
-
like so:
|
79
|
-
|
80
|
-
lp [], :private => true
|
81
|
-
lp [], :private # shortcut
|
82
|
-
|
83
|
-
Or if you don't want protected:
|
84
|
-
|
85
|
-
lp [], :protected => false
|
86
|
-
|
87
|
-
There are variations too. And you can configure things. And you can
|
88
|
-
use it as a library without polluting the built-in classes. See:
|
89
|
-
|
90
|
-
$ ri Looksee
|
91
|
-
|
92
|
-
Or do this in IRB for a quick reference:
|
93
|
-
|
94
|
-
Looksee.help
|
95
|
-
|
96
|
-
Enjoy!
|
97
|
-
|
98
|
-
== INSTALL
|
99
|
-
|
100
|
-
gem install looksee
|
101
|
-
|
102
|
-
== FEATURES/PROBLEMS
|
103
|
-
|
104
|
-
* Currently only does MRI 1.8, 1.9.
|
105
|
-
|
106
|
-
== LICENSE
|
107
|
-
|
108
|
-
(The MIT License)
|
109
|
-
|
110
|
-
Copyright (c) 2009 George Ogata
|
111
|
-
|
112
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
113
|
-
a copy of this software and associated documentation files (the
|
114
|
-
'Software'), to deal in the Software without restriction, including
|
115
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
116
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
117
|
-
permit persons to whom the Software is furnished to do so, subject to
|
118
|
-
the following conditions:
|
119
|
-
|
120
|
-
The above copyright notice and this permission notice shall be
|
121
|
-
included in all copies or substantial portions of the Software.
|
122
|
-
|
123
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
124
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
125
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
126
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
127
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
128
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
129
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/ext/looksee/extconf.rb
DELETED
data/ext/looksee/looksee.c
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
#include "ruby.h"
|
2
|
-
|
3
|
-
#if RUBY_VERSION >= 190
|
4
|
-
# include "node-1.9.h"
|
5
|
-
# include "ruby/st.h"
|
6
|
-
#else
|
7
|
-
# include "node.h"
|
8
|
-
# include "st.h"
|
9
|
-
#endif
|
10
|
-
|
11
|
-
#if RUBY_VERSION < 187
|
12
|
-
# define RCLASS_IV_TBL(c) (RCLASS(c)->iv_tbl)
|
13
|
-
# define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
14
|
-
# define RCLASS_SUPER(c) (RCLASS(c)->super)
|
15
|
-
#endif
|
16
|
-
|
17
|
-
/*
|
18
|
-
* Return the internal superclass of this class.
|
19
|
-
*
|
20
|
-
* This is either a Class or "IClass." IClasses represent Modules
|
21
|
-
* included in the ancestry, and should be treated as opaque objects
|
22
|
-
* in ruby space. Convert the IClass to a Module using #iclass_to_module
|
23
|
-
* before using it in ruby.
|
24
|
-
*/
|
25
|
-
VALUE Looksee_internal_superclass(VALUE self, VALUE internal_class) {
|
26
|
-
VALUE super = RCLASS_SUPER(internal_class);
|
27
|
-
if (!super)
|
28
|
-
return Qnil;
|
29
|
-
return super;
|
30
|
-
}
|
31
|
-
|
32
|
-
/*
|
33
|
-
* Return the internal class of the given object.
|
34
|
-
*
|
35
|
-
* This is either the object's singleton class, if it exists, or the
|
36
|
-
* object's birth class.
|
37
|
-
*/
|
38
|
-
VALUE Looksee_internal_class(VALUE self, VALUE object) {
|
39
|
-
return CLASS_OF(object);
|
40
|
-
}
|
41
|
-
|
42
|
-
/*
|
43
|
-
* Return the class or module that the given internal class
|
44
|
-
* represents.
|
45
|
-
*
|
46
|
-
* If a class is given, this is the class. If an iclass is given,
|
47
|
-
* this is the module it represents in the lookup chain.
|
48
|
-
*/
|
49
|
-
VALUE Looksee_internal_class_to_module(VALUE self, VALUE internal_class) {
|
50
|
-
if (!SPECIAL_CONST_P(internal_class)) {
|
51
|
-
switch (BUILTIN_TYPE(internal_class)) {
|
52
|
-
case T_ICLASS:
|
53
|
-
return RBASIC(internal_class)->klass;
|
54
|
-
case T_CLASS:
|
55
|
-
return internal_class;
|
56
|
-
}
|
57
|
-
}
|
58
|
-
rb_raise(rb_eArgError, "not an internal class: %s", RSTRING_PTR(rb_inspect(internal_class)));
|
59
|
-
}
|
60
|
-
|
61
|
-
typedef struct add_method_if_matching_arg {
|
62
|
-
VALUE names;
|
63
|
-
int visibility;
|
64
|
-
} add_method_if_matching_arg_t;
|
65
|
-
|
66
|
-
#if RUBY_VERSION < 190
|
67
|
-
# define VISIBILITY(node) ((node)->nd_noex & NOEX_MASK)
|
68
|
-
#else
|
69
|
-
# define VISIBILITY(node) ((node)->nd_body->nd_noex & NOEX_MASK)
|
70
|
-
#endif
|
71
|
-
|
72
|
-
static int add_method_if_matching(ID method_name, NODE *body, add_method_if_matching_arg_t *arg) {
|
73
|
-
/* This entry is for the internal allocator function. */
|
74
|
-
if (method_name == ID_ALLOCATOR)
|
75
|
-
return ST_CONTINUE;
|
76
|
-
|
77
|
-
/* Module#undef_method sets body->nd_body to NULL. */
|
78
|
-
if (!body || !body->nd_body)
|
79
|
-
return ST_CONTINUE;
|
80
|
-
|
81
|
-
if (VISIBILITY(body) == arg->visibility)
|
82
|
-
rb_ary_push(arg->names, ID2SYM(method_name));
|
83
|
-
return ST_CONTINUE;
|
84
|
-
}
|
85
|
-
|
86
|
-
static VALUE internal_instance_methods(VALUE klass, long visibility) {
|
87
|
-
add_method_if_matching_arg_t arg;
|
88
|
-
arg.names = rb_ary_new();
|
89
|
-
arg.visibility = visibility;
|
90
|
-
st_foreach(RCLASS_M_TBL(klass), add_method_if_matching, (st_data_t)&arg);
|
91
|
-
return arg.names;
|
92
|
-
}
|
93
|
-
|
94
|
-
/*
|
95
|
-
* Return the list of public instance methods (as Symbols) of the
|
96
|
-
* given internal class.
|
97
|
-
*/
|
98
|
-
VALUE Looksee_internal_public_instance_methods(VALUE self, VALUE klass) {
|
99
|
-
return internal_instance_methods(klass, NOEX_PUBLIC);
|
100
|
-
}
|
101
|
-
|
102
|
-
/*
|
103
|
-
* Return the list of protected instance methods (as Symbols) of the
|
104
|
-
* given internal class.
|
105
|
-
*/
|
106
|
-
VALUE Looksee_internal_protected_instance_methods(VALUE self, VALUE klass) {
|
107
|
-
return internal_instance_methods(klass, NOEX_PROTECTED);
|
108
|
-
}
|
109
|
-
|
110
|
-
/*
|
111
|
-
* Return the list of private instance methods (as Symbols) of the
|
112
|
-
* given internal class.
|
113
|
-
*/
|
114
|
-
VALUE Looksee_internal_private_instance_methods(VALUE self, VALUE klass) {
|
115
|
-
return internal_instance_methods(klass, NOEX_PRIVATE);
|
116
|
-
}
|
117
|
-
|
118
|
-
static int add_method_if_undefined(ID method_name, NODE *body, VALUE *names) {
|
119
|
-
/* Module#undef_method sets body->nd_body to NULL. */
|
120
|
-
if (body && !body->nd_body)
|
121
|
-
rb_ary_push(*names, ID2SYM(method_name));
|
122
|
-
return ST_CONTINUE;
|
123
|
-
}
|
124
|
-
|
125
|
-
/*
|
126
|
-
* Return the list of undefined instance methods (as Symbols) of the
|
127
|
-
* given internal class.
|
128
|
-
*/
|
129
|
-
VALUE Looksee_internal_undefined_instance_methods(VALUE self, VALUE klass) {
|
130
|
-
VALUE names = rb_ary_new();
|
131
|
-
st_foreach(RCLASS_M_TBL(klass), add_method_if_undefined, (st_data_t)&names);
|
132
|
-
return names;
|
133
|
-
}
|
134
|
-
|
135
|
-
void Init_looksee(void) {
|
136
|
-
VALUE mLooksee = rb_define_module("Looksee");
|
137
|
-
rb_define_singleton_method(mLooksee, "internal_superclass", Looksee_internal_superclass, 1);
|
138
|
-
rb_define_singleton_method(mLooksee, "internal_class", Looksee_internal_class, 1);
|
139
|
-
rb_define_singleton_method(mLooksee, "internal_class_to_module", Looksee_internal_class_to_module, 1);
|
140
|
-
rb_define_singleton_method(mLooksee, "internal_public_instance_methods", Looksee_internal_public_instance_methods, 1);
|
141
|
-
rb_define_singleton_method(mLooksee, "internal_protected_instance_methods", Looksee_internal_protected_instance_methods, 1);
|
142
|
-
rb_define_singleton_method(mLooksee, "internal_private_instance_methods", Looksee_internal_private_instance_methods, 1);
|
143
|
-
rb_define_singleton_method(mLooksee, "internal_undefined_instance_methods", Looksee_internal_undefined_instance_methods, 1);
|
144
|
-
}
|