rubysl-delegate 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0eced264b69375946afd5adf72327ac9006d09ad
4
- data.tar.gz: 93f3a46d00dfd8cd429bddaa17866e6ca425671d
3
+ metadata.gz: 32a72677c8916a5d20eaaa8833b7db5df034580d
4
+ data.tar.gz: 1af2b0d39b67dec79a7684ee0c542f371c3ddb76
5
5
  SHA512:
6
- metadata.gz: a532da1faa6f9ecc57316bca8b1bce391718439b86a2275633b11bcf1831aaf4eda5b31848df01a3cfebe14b0c19dc7d6dba8604006f08139aa9b2f726b34105
7
- data.tar.gz: 6a06857191f3019166b3a3657473e347929afbb3dedb8fd0bf34bdb549f7ff7bbe07e47c9c920da2393770b8d8e4816dbf2b94f946a530fa87c4e31ec4037919
6
+ metadata.gz: fb3f4bad019d173c1130fda7c41663d425275fafaa368879a4666e53d0c69d651b588a02a73c1ce800822ddf95a9032b8c8836badfd5ef4ddf91ab91a9feebb7
7
+ data.tar.gz: 8663a6e30af98ccafc864f254f6ea3ac8451ad34b0c291869d477257831fc6f5814dadc9324f4acb53b553714af50170034313f0da2ecfefd089db2247a53413
@@ -1,7 +1,14 @@
1
1
  language: ruby
2
2
  env:
3
3
  - RUBYLIB=lib
4
- script: bundle exec mspec
4
+ - RUBYLIB=
5
+ script: mspec spec
5
6
  rvm:
6
- - 1.9.3
7
- - rbx-nightly-19mode
7
+ - 2.0.0
8
+ - rbx-2.1.1
9
+ matrix:
10
+ exclude:
11
+ - rvm: 2.0.0
12
+ env: RUBYLIB=lib
13
+ - rvm: rbx-2.1.1
14
+ env: RUBYLIB=
@@ -93,11 +93,7 @@ class Delegator < BasicObject
93
93
  # of this object's and \_\_getobj\_\_ methods.
94
94
  #
95
95
  def methods(all=true)
96
- if all
97
- __getobj__.methods | super
98
- else
99
- __getobj__.singleton_methods | singleton_methods
100
- end
96
+ __getobj__.methods(all) | super
101
97
  end
102
98
 
103
99
  #
@@ -134,6 +130,9 @@ class Delegator < BasicObject
134
130
  __getobj__ != obj
135
131
  end
136
132
 
133
+ #
134
+ # Delegates ! to the \_\_getobj\_\_
135
+ #
137
136
  def !
138
137
  !__getobj__
139
138
  end
@@ -158,7 +157,7 @@ class Delegator < BasicObject
158
157
  # Serialization support for the object returned by \_\_getobj\_\_.
159
158
  #
160
159
  def marshal_dump
161
- ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var.to_s}
160
+ ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var}
162
161
  [
163
162
  :__v2__,
164
163
  ivars, ivars.map{|var| instance_variable_get(var)},
@@ -231,6 +230,34 @@ end
231
230
  # and even to change the object being delegated to at a later time with
232
231
  # #__setobj__.
233
232
  #
233
+ # class User
234
+ # def born_on
235
+ # Date.new(1989, 09, 10)
236
+ # end
237
+ # end
238
+ #
239
+ # class UserDecorator < SimpleDelegator
240
+ # def birth_year
241
+ # born_on.year
242
+ # end
243
+ # end
244
+ #
245
+ # decorated_user = UserDecorator.new(User.new)
246
+ # decorated_user.birth_year #=> 1989
247
+ # decorated_user.__getobj__ #=> #<User: ...>
248
+ #
249
+ # A SimpleDelegator instance can take advantage of the fact that SimpleDelegator
250
+ # is a subclass of +Delegator+ to call <tt>super</tt> to have methods called on
251
+ # the object being delegated to.
252
+ #
253
+ # class SuperArray < SimpleDelegator
254
+ # def [](*args)
255
+ # super + 1
256
+ # end
257
+ # end
258
+ #
259
+ # SuperArray.new([1])[0] #=> 2
260
+ #
234
261
  # Here's a simple example that takes advantage of the fact that
235
262
  # SimpleDelegator's delegation object can be changed at any time.
236
263
  #
@@ -289,8 +316,7 @@ class SimpleDelegator<Delegator
289
316
  end
290
317
  end
291
318
 
292
- # :stopdoc:
293
- def Delegator.delegating_block(mid)
319
+ def Delegator.delegating_block(mid) # :nodoc:
294
320
  lambda do |*args, &block|
295
321
  target = self.__getobj__
296
322
  begin
@@ -300,7 +326,6 @@ def Delegator.delegating_block(mid)
300
326
  end
301
327
  end
302
328
  end
303
- # :startdoc:
304
329
 
305
330
  #
306
331
  # The primary interface to this library. Use to setup delegation when defining
@@ -393,4 +418,4 @@ if __FILE__ == $0
393
418
  p foo.test == foo2.test # => true
394
419
  p foo2.iter{[55,true]} # => true
395
420
  foo2.error # raise error!
396
- end
421
+ end
@@ -1,5 +1,5 @@
1
1
  module RubySL
2
2
  module Delegator
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_development_dependency "mspec", "~> 1.5"
24
+ spec.add_development_dependency "rubysl-prettyprint", "~> 2.0"
24
25
  end
metadata CHANGED
@@ -1,57 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubysl-delegate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Shirai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-17 00:00:00.000000000 Z
11
+ date: 2013-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.5'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubysl-prettyprint
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
55
69
  description: Ruby standard library delegate.
56
70
  email:
57
71
  - brixen@gmail.com
@@ -59,8 +73,8 @@ executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
- - .gitignore
63
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".travis.yml"
64
78
  - Gemfile
65
79
  - LICENSE
66
80
  - README.md
@@ -108,12 +122,12 @@ require_paths:
108
122
  - lib
109
123
  required_ruby_version: !ruby/object:Gem::Requirement
110
124
  requirements:
111
- - - ~>
125
+ - - "~>"
112
126
  - !ruby/object:Gem::Version
113
127
  version: '2.0'
114
128
  required_rubygems_version: !ruby/object:Gem::Requirement
115
129
  requirements:
116
- - - '>='
130
+ - - ">="
117
131
  - !ruby/object:Gem::Version
118
132
  version: '0'
119
133
  requirements: []
@@ -151,3 +165,4 @@ test_files:
151
165
  - spec/delegator/untaint_spec.rb
152
166
  - spec/delegator/untrust_spec.rb
153
167
  - spec/fixtures/classes.rb
168
+ has_rdoc: