explainification 0.0.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.
Files changed (2) hide show
  1. data/lib/explainification.rb +33 -0
  2. metadata +46 -0
@@ -0,0 +1,33 @@
1
+ BasicObject.instance_eval do
2
+ def explainify
3
+ puts "explainification (instance eval) pending #{self.inspect}"
4
+ puts method_list self
5
+ end
6
+ end
7
+
8
+ BasicObject.class_eval do
9
+ def explainify
10
+ puts "explainification pending (class eval) #{self.inspect}"
11
+ puts method_list self
12
+ puts "....."
13
+ end
14
+ end
15
+
16
+ def method_list obj
17
+
18
+ "singleton methods:\n".tap do |s|
19
+ obj.singleton_methods.each do |sm|
20
+ m = obj.method(sm)
21
+ s << " %40s : %40s : %16s\n" % [sm, m.source_location, m.owner]
22
+ end
23
+ klass = obj.class
24
+ [klass].concat(klass.included_modules).each do |imodule|
25
+ s << "#{imodule}:\n"
26
+ imodule.instance_methods(false).each do |imethod|
27
+ m = obj.method imethod
28
+ s << " %40s : %40s : %16s\n" % [ imethod, m.source_location, m.owner]
29
+ end
30
+ end
31
+ end
32
+ end
33
+
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: explainification
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tony Green
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-19 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Explainifies ruby objects and classes in the console by showing you their
15
+ source structure
16
+ email: tonygreen@techie.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/explainification.rb
22
+ homepage: http://example.com/explainification
23
+ licenses: []
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 1.8.24
43
+ signing_key:
44
+ specification_version: 3
45
+ summary: ''
46
+ test_files: []