mattknox-repl 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.
- data/lib/repl.rb +20 -0
- metadata +53 -0
data/lib/repl.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
CONTEXT_STACK = []
|
2
|
+
DEFAULT_STARTING_SELF = self
|
3
|
+
|
4
|
+
module Repl
|
5
|
+
def repl
|
6
|
+
DEFAULT_STARTING_SELF.cb self
|
7
|
+
CONTEXT_STACK.push(self)
|
8
|
+
end
|
9
|
+
|
10
|
+
def stop_repl
|
11
|
+
DEFAULT_STARTING_SELF.cb CONTEXT_STACK.pop
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module HookRepl
|
16
|
+
def self.replize_object(obj, class_or_instance_or_both = :both)
|
17
|
+
obj.class_eval "extend Repl" if [:class, :both].member?(class_or_instance_or_both)
|
18
|
+
obj.class_eval "include Repl" if [:object, :both].member?(class_or_instance_or_both)
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mattknox-repl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- matt knox
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-11-16 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Repl makes it possible to change IRB's notion of self to be any object or class.
|
17
|
+
email: matthewknox@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/repl.rb
|
26
|
+
has_rdoc: false
|
27
|
+
homepage: http://github.com/mattknox/repl
|
28
|
+
post_install_message:
|
29
|
+
rdoc_options: []
|
30
|
+
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: "0"
|
38
|
+
version:
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
requirements: []
|
46
|
+
|
47
|
+
rubyforge_project:
|
48
|
+
rubygems_version: 1.2.0
|
49
|
+
signing_key:
|
50
|
+
specification_version: 2
|
51
|
+
summary: ""
|
52
|
+
test_files: []
|
53
|
+
|