looksee 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.
@@ -0,0 +1,80 @@
1
+ require 'spec'
2
+ require 'mocha'
3
+ require 'looksee'
4
+
5
+ require 'set'
6
+
7
+ Spec::Runner.configure do |config|
8
+ config.mock_with :mocha
9
+ end
10
+
11
+ class Object
12
+ #
13
+ # Return this object's singleton class.
14
+ #
15
+ def singleton_class
16
+ class << self; self; end
17
+ end
18
+
19
+ #
20
+ # Return true if the given object include?-s this object.
21
+ #
22
+ def in?(object)
23
+ object.include?(self)
24
+ end
25
+ end
26
+
27
+ class String
28
+ #
29
+ # Remove a left margin delimited by '|'-characters. Useful for
30
+ # heredocs:
31
+ #
32
+ def demargin
33
+ gsub(/^ *\|/, '')
34
+ end
35
+ end
36
+
37
+ #
38
+ # Include these in example groups to add facilities to create
39
+ # temporary classes and modules, which are swept up at the end of each
40
+ # example.
41
+ #
42
+ # Call make_class('ClassName') or make_module('ModuleName') to create
43
+ # a temporary class, then access them with plain constants (ClassName,
44
+ # ModuleName).
45
+ #
46
+ module TemporaryClasses
47
+ def self.included(mod)
48
+ mod.before do
49
+ @temporary_modules = []
50
+ end
51
+
52
+ mod.after do
53
+ @temporary_modules.each do |mod|
54
+ Object.send :remove_const, mod.name
55
+ end
56
+ end
57
+ end
58
+
59
+ #
60
+ # Create a temporary class with the given name and superclass.
61
+ #
62
+ def temporary_class(name, superclass=Object, &block)
63
+ klass = Class.new(superclass)
64
+ Object.const_set(name, klass)
65
+ klass.class_eval(&block) if block
66
+ @temporary_modules << klass
67
+ klass
68
+ end
69
+
70
+ #
71
+ # Create a temporary module with the given name.
72
+ #
73
+ def temporary_module(name, &block)
74
+ mod = Module.new
75
+ Object.const_set(name, mod)
76
+ mod.class_eval(&block) if block
77
+ @temporary_modules << mod
78
+ mod
79
+ end
80
+ end
@@ -0,0 +1,13 @@
1
+ namespace :extconf do
2
+ desc "Compiles the Ruby extension"
3
+ task :compile
4
+ end
5
+
6
+ task :compile => "extconf:compile"
7
+
8
+ task :test => :compile
9
+
10
+ BIN = "*.{bundle,jar,so,obj,pdb,lib,def,exp}"
11
+ $hoe.clean_globs |= ["ext/**/#{BIN}", "lib/**/#{BIN}", 'ext/**/Makefile']
12
+ $hoe.spec.require_paths = Dir['{lib,ext/*}']
13
+ $hoe.spec.extensions = FileList["ext/**/extconf.rb"].to_a
@@ -0,0 +1,43 @@
1
+ namespace :extconf do
2
+ extension = File.basename(__FILE__, '.rake')
3
+
4
+ ext = "ext/#{extension}"
5
+ ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
6
+ ext_files = FileList[
7
+ "#{ext}/*.c",
8
+ "#{ext}/*.h",
9
+ "#{ext}/*.rl",
10
+ "#{ext}/extconf.rb",
11
+ "#{ext}/Makefile",
12
+ # "lib"
13
+ ]
14
+
15
+
16
+ task :compile => extension do
17
+ if Dir.glob("**/#{extension}.{o,so,dll}").length == 0
18
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
+ STDERR.puts "Gem actually failed to build. Your system is"
20
+ STDERR.puts "NOT configured properly to build looksee."
21
+ STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
22
+ exit(1)
23
+ end
24
+ end
25
+
26
+ desc "Builds just the #{extension} extension"
27
+ task extension.to_sym => ["#{ext}/Makefile", ext_so ]
28
+
29
+ file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
30
+ Dir.chdir(ext) do ruby "extconf.rb" end
31
+ end
32
+
33
+ file ext_so => ext_files do
34
+ Dir.chdir(ext) do
35
+ sh(RUBY_PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
36
+ if !ok
37
+ require "fileutils"
38
+ FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: looksee
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - George Ogata
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-05 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.5.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.7
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: mocha
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.9.5
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: hoe
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.3.2
54
+ version:
55
+ description: |-
56
+ Looksee lets you examine the method lookup path of objects in ways not
57
+ possible in plain ruby.
58
+
59
+ Pop this in your .irbrc :
60
+
61
+ require 'looksee/shortcuts'
62
+
63
+ This defines a method +lp+ ("lookup path") which lets you do:
64
+
65
+ irb(main):001:0> lp []
66
+ => Array
67
+ & concat frozen? push taguri
68
+ * count hash rassoc taguri=
69
+ + cycle include? reject take
70
+ - delete index reject! take_while
71
+ << delete_at indexes replace to_a
72
+ <=> delete_if indices reverse to_ary
73
+ == drop insert reverse! to_s
74
+ [] drop_while inspect reverse_each to_yaml
75
+ []= each join rindex transpose
76
+ assoc each_index last select uniq
77
+ at empty? length shift uniq!
78
+ choice eql? map shuffle unshift
79
+ clear fetch map! shuffle! values_at
80
+ collect fill nitems size yaml_initialize
81
+ collect! find_index pack slice zip
82
+ combination first permutation slice! |
83
+ compact flatten pop sort
84
+ compact! flatten! product sort!
85
+ Enumerable
86
+ all? each_slice first min reverse_each
87
+ any? each_with_index grep min_by select
88
+ collect entries group_by minmax sort
89
+ count enum_cons include? minmax_by sort_by
90
+ cycle enum_slice inject none? take
91
+ detect enum_with_index map one? take_while
92
+ drop find max partition to_a
93
+ drop_while find_all max_by reduce zip
94
+ each_cons find_index member? reject
95
+ Object
96
+ taguri taguri= to_yaml to_yaml_properties to_yaml_style
97
+ Kernel
98
+ == hash object_id
99
+ === id private_methods
100
+ =~ inspect protected_methods
101
+ __id__ instance_eval public_methods
102
+ __send__ instance_exec respond_to?
103
+ class instance_of? send
104
+ clone instance_variable_defined? singleton_methods
105
+ display instance_variable_get taint
106
+ dup instance_variable_set tainted?
107
+ enum_for instance_variables tap
108
+ eql? is_a? to_a
109
+ equal? kind_of? to_enum
110
+ extend method to_s
111
+ freeze methods type
112
+ frozen? nil? untaint
113
+
114
+ It'll also color the methods according to whether they're public,
115
+ protected, private, or overridden. So pretty. You gotta try it.
116
+
117
+ By default, it shows public and protected methods. Add private ones
118
+ like so:
119
+
120
+ lp [], :private => true
121
+ lp [], :private # shortcut
122
+
123
+ Or if you don't want protected:
124
+
125
+ lp [], :protected => false
126
+
127
+ There are variations too. And you can configure things. And you can
128
+ use it as a library without polluting the built-in classes. See:
129
+
130
+ $ ri Looksee
131
+
132
+ Enjoy!
133
+ email:
134
+ - george.ogata@gmail.com
135
+ executables: []
136
+
137
+ extensions:
138
+ - ext/looksee/extconf.rb
139
+ extra_rdoc_files:
140
+ - History.txt
141
+ - Manifest.txt
142
+ files:
143
+ - .autotest
144
+ - History.txt
145
+ - Manifest.txt
146
+ - README.rdoc
147
+ - Rakefile
148
+ - ext/looksee/extconf.rb
149
+ - ext/looksee/looksee.c
150
+ - ext/looksee/node-1.9.h
151
+ - lib/looksee.rb
152
+ - lib/looksee/shortcuts.rb
153
+ - lib/looksee/version.rb
154
+ - script/console
155
+ - script/destroy
156
+ - script/generate
157
+ - spec/looksee_spec.rb
158
+ - spec/spec_helper.rb
159
+ - tasks/extconf.rake
160
+ - tasks/extconf/looksee.rake
161
+ has_rdoc: true
162
+ homepage: http://github.com/oggy/looksee
163
+ licenses: []
164
+
165
+ post_install_message:
166
+ rdoc_options:
167
+ - --main
168
+ - README.rdoc
169
+ require_paths:
170
+ - lib
171
+ - ext/looksee
172
+ required_ruby_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: "0"
177
+ version:
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: "0"
183
+ version:
184
+ requirements: []
185
+
186
+ rubyforge_project: looksee
187
+ rubygems_version: 1.3.4
188
+ signing_key:
189
+ specification_version: 3
190
+ summary: Looksee lets you examine the method lookup path of objects in ways not possible in plain ruby
191
+ test_files: []
192
+