proxy_machine 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ == Description
2
+
3
+ A cool proxy implementation pattern in ruby
4
+
5
+ == Install
6
+
7
+ sudo gem install proxy_machine
8
+
1
9
  == Example usage
2
10
 
3
11
  === The awesome way:
@@ -11,6 +19,27 @@
11
19
 
12
20
  p.reverse => before reverse
13
21
  [3, 2, 1]
22
+
23
+ === How to detect that the object is a proxy?
24
+
25
+ The beautiful way
26
+
27
+ o1 = [1, 2, 3]
28
+ o1.proxied? => false
29
+
30
+ o2 = proxy_for [1, 2, 3]
31
+ o2.proxied? => true
32
+
33
+ Other way
34
+
35
+ p = proxy_for [1, 2, 3]
36
+ defined? p.proxied_class?
37
+
38
+ === Trying it in irb
39
+
40
+ irb
41
+ require 'proxy_machine'
42
+ proxy_for...
14
43
 
15
44
  === Other ways:
16
45
 
data/Rakefile CHANGED
@@ -8,6 +8,7 @@ begin
8
8
  gemspec.homepage = "http://github.com/tulios/proxy_machine"
9
9
  gemspec.authors = ["Túlio Ornelas"]
10
10
  gemspec.test_files = Dir.glob('spec/*_spec.rb')
11
+ gemspec.add_development_dependency "rspec", ">= 1.2.9"
11
12
  end
12
13
  Jeweler::GemcutterTasks.new
13
14
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/init.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'proxy_machine'
2
2
  include ProxyMachine
3
3
 
4
- require 'kernel'
4
+ require 'kernel'
5
+ require 'object'
data/lib/kernel.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'proxy_machine'
2
+
2
3
  module Kernel
3
4
 
4
5
  def proxy_for object, callbacks = nil
data/lib/object.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'proxy_machine'
2
+ require 'kernel'
3
+
4
+ class Object
5
+
6
+ def proxied?
7
+ not (defined? self.proxied_class?).nil?
8
+ end
9
+
10
+ end
data/lib/proxy_machine.rb CHANGED
@@ -9,4 +9,5 @@ end
9
9
  require 'proxy_machine/proxy'
10
10
  include ProxyMachine
11
11
 
12
- require 'kernel'
12
+ require 'kernel'
13
+ require 'object'
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{proxy_machine}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["T\303\272lio Ornelas"]
12
- s.date = %q{2010-10-03}
12
+ s.date = %q{2010-10-05}
13
13
  s.description = %q{A cool proxy implementation pattern in ruby}
14
14
  s.email = %q{ornelas.tulio@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  "VERSION",
24
24
  "init.rb",
25
25
  "lib/kernel.rb",
26
+ "lib/object.rb",
26
27
  "lib/proxy_machine.rb",
27
28
  "lib/proxy_machine/proxy.rb",
28
29
  "proxy_machine.gemspec",
@@ -42,9 +43,12 @@ Gem::Specification.new do |s|
42
43
  s.specification_version = 3
43
44
 
44
45
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
46
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
45
47
  else
48
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
46
49
  end
47
50
  else
51
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
48
52
  end
49
53
  end
50
54
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_machine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - "T\xC3\xBAlio Ornelas"
@@ -15,10 +15,25 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-03 00:00:00 -03:00
18
+ date: 2010-10-05 00:00:00 -03:00
19
19
  default_executable:
20
- dependencies: []
21
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 9
34
+ version: 1.2.9
35
+ type: :development
36
+ version_requirements: *id001
22
37
  description: A cool proxy implementation pattern in ruby
23
38
  email: ornelas.tulio@gmail.com
24
39
  executables: []
@@ -35,6 +50,7 @@ files:
35
50
  - VERSION
36
51
  - init.rb
37
52
  - lib/kernel.rb
53
+ - lib/object.rb
38
54
  - lib/proxy_machine.rb
39
55
  - lib/proxy_machine/proxy.rb
40
56
  - proxy_machine.gemspec