rubysl-delegate 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +25 -0
  6. data/README.md +29 -0
  7. data/Rakefile +1 -0
  8. data/lib/delegate.rb +1 -0
  9. data/lib/rubysl/delegate.rb +2 -0
  10. data/lib/rubysl/delegate/delegate.rb +337 -0
  11. data/lib/rubysl/delegate/version.rb +5 -0
  12. data/rubysl-delegate.gemspec +22 -0
  13. data/spec/delegate_class/instance_method_spec.rb +53 -0
  14. data/spec/delegate_class/instance_methods_spec.rb +49 -0
  15. data/spec/delegate_class/private_instance_methods_spec.rb +41 -0
  16. data/spec/delegate_class/protected_instance_methods_spec.rb +55 -0
  17. data/spec/delegate_class/public_instance_methods_spec.rb +45 -0
  18. data/spec/delegator/case_compare_spec.rb +10 -0
  19. data/spec/delegator/compare_spec.rb +10 -0
  20. data/spec/delegator/complement_spec.rb +12 -0
  21. data/spec/delegator/eql_spec.rb +12 -0
  22. data/spec/delegator/equal_spec.rb +12 -0
  23. data/spec/delegator/equal_value_spec.rb +31 -0
  24. data/spec/delegator/frozen_spec.rb +48 -0
  25. data/spec/delegator/hash_spec.rb +12 -0
  26. data/spec/delegator/marshal_spec.rb +22 -0
  27. data/spec/delegator/method_spec.rb +76 -0
  28. data/spec/delegator/methods_spec.rb +65 -0
  29. data/spec/delegator/not_equal_spec.rb +25 -0
  30. data/spec/delegator/not_spec.rb +12 -0
  31. data/spec/delegator/private_methods_spec.rb +33 -0
  32. data/spec/delegator/protected_methods_spec.rb +31 -0
  33. data/spec/delegator/public_methods_spec.rb +29 -0
  34. data/spec/delegator/send_spec.rb +33 -0
  35. data/spec/delegator/taint_spec.rb +24 -0
  36. data/spec/delegator/tap_spec.rb +17 -0
  37. data/spec/delegator/trust_spec.rb +41 -0
  38. data/spec/delegator/untaint_spec.rb +25 -0
  39. data/spec/delegator/untrust_spec.rb +24 -0
  40. data/spec/fixtures/classes.rb +65 -0
  41. metadata +153 -0
@@ -0,0 +1,65 @@
1
+ require 'delegate'
2
+ module DelegateSpecs
3
+ class Simple
4
+ def pub
5
+ :foo
6
+ end
7
+
8
+ def respond_to_missing?(method, priv=false)
9
+ method == :pub_too ||
10
+ (priv && method == :priv_too)
11
+ end
12
+
13
+ def method_missing(method, *args)
14
+ super unless respond_to_missing?(method, true)
15
+ method
16
+ end
17
+
18
+ def priv(arg=nil)
19
+ yield arg if block_given?
20
+ [:priv, arg]
21
+ end
22
+ private :priv
23
+
24
+ def prot
25
+ :protected
26
+ end
27
+ protected :prot
28
+ end
29
+
30
+ module Extra
31
+ def extra
32
+ :cheese
33
+ end
34
+
35
+ def extra_private
36
+ :bar
37
+ end
38
+ private :extra_private
39
+
40
+ def extra_protected
41
+ :baz
42
+ end
43
+ protected :extra_protected
44
+ end
45
+
46
+ class Delegator < ::Delegator
47
+ attr_accessor :data
48
+
49
+ attr_reader :__getobj__
50
+ def __setobj__(o)
51
+ @__getobj__ = o
52
+ end
53
+
54
+ # Needed for 1.8.x compatibility
55
+ def initialize(obj)
56
+ super
57
+ __setobj__(obj)
58
+ end
59
+ include Extra
60
+ end
61
+
62
+ class DelegateClass < DelegateClass(Simple)
63
+ include Extra
64
+ end
65
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubysl-delegate
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Shirai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
55
+ description: Ruby standard library delegate.
56
+ email:
57
+ - brixen@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gitignore
63
+ - .travis.yml
64
+ - Gemfile
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - lib/delegate.rb
69
+ - lib/rubysl/delegate.rb
70
+ - lib/rubysl/delegate/delegate.rb
71
+ - lib/rubysl/delegate/version.rb
72
+ - rubysl-delegate.gemspec
73
+ - spec/delegate_class/instance_method_spec.rb
74
+ - spec/delegate_class/instance_methods_spec.rb
75
+ - spec/delegate_class/private_instance_methods_spec.rb
76
+ - spec/delegate_class/protected_instance_methods_spec.rb
77
+ - spec/delegate_class/public_instance_methods_spec.rb
78
+ - spec/delegator/case_compare_spec.rb
79
+ - spec/delegator/compare_spec.rb
80
+ - spec/delegator/complement_spec.rb
81
+ - spec/delegator/eql_spec.rb
82
+ - spec/delegator/equal_spec.rb
83
+ - spec/delegator/equal_value_spec.rb
84
+ - spec/delegator/frozen_spec.rb
85
+ - spec/delegator/hash_spec.rb
86
+ - spec/delegator/marshal_spec.rb
87
+ - spec/delegator/method_spec.rb
88
+ - spec/delegator/methods_spec.rb
89
+ - spec/delegator/not_equal_spec.rb
90
+ - spec/delegator/not_spec.rb
91
+ - spec/delegator/private_methods_spec.rb
92
+ - spec/delegator/protected_methods_spec.rb
93
+ - spec/delegator/public_methods_spec.rb
94
+ - spec/delegator/send_spec.rb
95
+ - spec/delegator/taint_spec.rb
96
+ - spec/delegator/tap_spec.rb
97
+ - spec/delegator/trust_spec.rb
98
+ - spec/delegator/untaint_spec.rb
99
+ - spec/delegator/untrust_spec.rb
100
+ - spec/fixtures/classes.rb
101
+ homepage: https://github.com/rubysl/rubysl-delegate
102
+ licenses:
103
+ - BSD
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '>='
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.0.7
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: Ruby standard library delegate.
125
+ test_files:
126
+ - spec/delegate_class/instance_method_spec.rb
127
+ - spec/delegate_class/instance_methods_spec.rb
128
+ - spec/delegate_class/private_instance_methods_spec.rb
129
+ - spec/delegate_class/protected_instance_methods_spec.rb
130
+ - spec/delegate_class/public_instance_methods_spec.rb
131
+ - spec/delegator/case_compare_spec.rb
132
+ - spec/delegator/compare_spec.rb
133
+ - spec/delegator/complement_spec.rb
134
+ - spec/delegator/eql_spec.rb
135
+ - spec/delegator/equal_spec.rb
136
+ - spec/delegator/equal_value_spec.rb
137
+ - spec/delegator/frozen_spec.rb
138
+ - spec/delegator/hash_spec.rb
139
+ - spec/delegator/marshal_spec.rb
140
+ - spec/delegator/method_spec.rb
141
+ - spec/delegator/methods_spec.rb
142
+ - spec/delegator/not_equal_spec.rb
143
+ - spec/delegator/not_spec.rb
144
+ - spec/delegator/private_methods_spec.rb
145
+ - spec/delegator/protected_methods_spec.rb
146
+ - spec/delegator/public_methods_spec.rb
147
+ - spec/delegator/send_spec.rb
148
+ - spec/delegator/taint_spec.rb
149
+ - spec/delegator/tap_spec.rb
150
+ - spec/delegator/trust_spec.rb
151
+ - spec/delegator/untaint_spec.rb
152
+ - spec/delegator/untrust_spec.rb
153
+ - spec/fixtures/classes.rb