nakajima-proxen 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/proxen.rb +25 -0
- metadata +53 -0
data/lib/proxen.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module Proxen
|
2
|
+
def proxy_to(target, options={})
|
3
|
+
if options[:blank_slate]
|
4
|
+
class_eval do
|
5
|
+
instance_methods.each do |sym|
|
6
|
+
undef_method(sym) unless sym.to_s =~ /__/
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
cond = options[:if] ? "sym.to_s =~ #{options[:if].inspect}" : "true"
|
12
|
+
|
13
|
+
class_eval(<<-END, __FILE__, __LINE__)
|
14
|
+
def method_missing(sym, *args, &block)
|
15
|
+
if #{cond}
|
16
|
+
#{target}.send(sym, *args, &block)
|
17
|
+
else
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
END
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Class.send :include, Proxen
|
metadata
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nakajima-proxen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pat Nakajima
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-02 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: patnakajima@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/proxen.rb
|
26
|
+
has_rdoc: false
|
27
|
+
homepage:
|
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: Easy method_missing proxies
|
52
|
+
test_files: []
|
53
|
+
|