gorillib 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/gorillib.gemspec +4 -3
  3. data/lib/gorillib/receiver.rb +20 -0
  4. metadata +99 -20
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/gorillib.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gorillib}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Infochimps"]
12
- s.date = %q{2011-06-29}
12
+ s.date = %q{2011-07-06}
13
13
  s.description = %q{Gorillib: infochimps lightweight subset of ruby convenience methods}
14
14
  s.email = %q{coders@infochimps.org}
15
15
  s.extra_rdoc_files = [
@@ -135,7 +135,7 @@ Gem::Specification.new do |s|
135
135
  s.homepage = %q{http://infochimps.com/labs}
136
136
  s.licenses = ["MIT"]
137
137
  s.require_paths = ["lib"]
138
- s.rubygems_version = %q{1.5.0}
138
+ s.rubygems_version = %q{1.3.7}
139
139
  s.summary = %q{include only what you need. No dependencies, no creep}
140
140
  s.test_files = [
141
141
  "spec/array/compact_blank_spec.rb",
@@ -188,6 +188,7 @@ Gem::Specification.new do |s|
188
188
  ]
189
189
 
190
190
  if s.respond_to? :specification_version then
191
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
191
192
  s.specification_version = 3
192
193
 
193
194
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -133,6 +133,7 @@ module Receiver
133
133
  _receive_attr attr, val
134
134
  end
135
135
  impose_defaults!(hsh)
136
+ replace_options!(hsh)
136
137
  run_after_receivers(hsh)
137
138
  self
138
139
  end
@@ -159,6 +160,25 @@ protected
159
160
  end
160
161
  end
161
162
 
163
+ # class Foo
164
+ # include Receiver
165
+ # include Receiver::ActsAsHash
166
+ # rcvr_accessor :attribute, String, :default => 'okay' :replace => { 'bad' => 'good' }
167
+ # end
168
+ #
169
+ # f = Foo.receive({:attribute => 'bad'})
170
+ # => #<Foo:0x10156c820 @attribute="good">
171
+
172
+ def replace_options!(hsh)
173
+ self.receiver_attrs.each do |attr, info|
174
+ val = self.instance_variable_get("@#{attr}")
175
+ if info[:replace] and info[:replace].has_key? val
176
+ self.instance_variable_set "@#{attr}", info[:replace][val]
177
+ end
178
+ end
179
+ end
180
+
181
+
162
182
  def run_after_receivers(hsh)
163
183
  self.class.after_receivers.each do |after_receiver|
164
184
  self.instance_exec(hsh, &after_receiver)
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorillib
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.3
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 4
10
+ version: 0.1.4
6
11
  platform: ruby
7
12
  authors:
8
13
  - Infochimps
@@ -10,172 +15,243 @@ autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-06-29 00:00:00 -05:00
18
+ date: 2011-07-06 00:00:00 -05:00
14
19
  default_executable:
15
20
  dependencies:
16
21
  - !ruby/object:Gem::Dependency
17
- name: bundler
18
22
  requirement: &id001 !ruby/object:Gem::Requirement
19
23
  none: false
20
24
  requirements:
21
25
  - - ~>
22
26
  - !ruby/object:Gem::Version
27
+ hash: 15
28
+ segments:
29
+ - 1
30
+ - 0
31
+ - 12
23
32
  version: 1.0.12
24
33
  type: :development
34
+ name: bundler
25
35
  prerelease: false
26
36
  version_requirements: *id001
27
37
  - !ruby/object:Gem::Dependency
28
- name: yard
29
38
  requirement: &id002 !ruby/object:Gem::Requirement
30
39
  none: false
31
40
  requirements:
32
41
  - - ~>
33
42
  - !ruby/object:Gem::Version
43
+ hash: 9
44
+ segments:
45
+ - 0
46
+ - 6
47
+ - 7
34
48
  version: 0.6.7
35
49
  type: :development
50
+ name: yard
36
51
  prerelease: false
37
52
  version_requirements: *id002
38
53
  - !ruby/object:Gem::Dependency
39
- name: jeweler
40
54
  requirement: &id003 !ruby/object:Gem::Requirement
41
55
  none: false
42
56
  requirements:
43
57
  - - ~>
44
58
  - !ruby/object:Gem::Version
59
+ hash: 7
60
+ segments:
61
+ - 1
62
+ - 5
63
+ - 2
45
64
  version: 1.5.2
46
65
  type: :development
66
+ name: jeweler
47
67
  prerelease: false
48
68
  version_requirements: *id003
49
69
  - !ruby/object:Gem::Dependency
50
- name: rspec
51
70
  requirement: &id004 !ruby/object:Gem::Requirement
52
71
  none: false
53
72
  requirements:
54
73
  - - ~>
55
74
  - !ruby/object:Gem::Version
75
+ hash: 27
76
+ segments:
77
+ - 2
78
+ - 5
79
+ - 0
56
80
  version: 2.5.0
57
81
  type: :development
82
+ name: rspec
58
83
  prerelease: false
59
84
  version_requirements: *id004
60
85
  - !ruby/object:Gem::Dependency
61
- name: spork
62
86
  requirement: &id005 !ruby/object:Gem::Requirement
63
87
  none: false
64
88
  requirements:
65
89
  - - ~>
66
90
  - !ruby/object:Gem::Version
91
+ hash: 977940482
92
+ segments:
93
+ - 0
94
+ - 9
95
+ - 0
96
+ - rc5
67
97
  version: 0.9.0.rc5
68
98
  type: :development
99
+ name: spork
69
100
  prerelease: false
70
101
  version_requirements: *id005
71
102
  - !ruby/object:Gem::Dependency
72
- name: RedCloth
73
103
  requirement: &id006 !ruby/object:Gem::Requirement
74
104
  none: false
75
105
  requirements:
76
106
  - - ">="
77
107
  - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
78
111
  version: "0"
79
112
  type: :development
113
+ name: RedCloth
80
114
  prerelease: false
81
115
  version_requirements: *id006
82
116
  - !ruby/object:Gem::Dependency
83
- name: rcov
84
117
  requirement: &id007 !ruby/object:Gem::Requirement
85
118
  none: false
86
119
  requirements:
87
120
  - - ">="
88
121
  - !ruby/object:Gem::Version
122
+ hash: 41
123
+ segments:
124
+ - 0
125
+ - 9
126
+ - 9
89
127
  version: 0.9.9
90
128
  type: :development
129
+ name: rcov
91
130
  prerelease: false
92
131
  version_requirements: *id007
93
132
  - !ruby/object:Gem::Dependency
94
- name: watchr
95
133
  requirement: &id008 !ruby/object:Gem::Requirement
96
134
  none: false
97
135
  requirements:
98
136
  - - ">="
99
137
  - !ruby/object:Gem::Version
138
+ hash: 3
139
+ segments:
140
+ - 0
100
141
  version: "0"
101
142
  type: :development
143
+ name: watchr
102
144
  prerelease: false
103
145
  version_requirements: *id008
104
146
  - !ruby/object:Gem::Dependency
105
- name: bundler
106
147
  requirement: &id009 !ruby/object:Gem::Requirement
107
148
  none: false
108
149
  requirements:
109
150
  - - ~>
110
151
  - !ruby/object:Gem::Version
152
+ hash: 15
153
+ segments:
154
+ - 1
155
+ - 0
156
+ - 12
111
157
  version: 1.0.12
112
158
  type: :development
159
+ name: bundler
113
160
  prerelease: false
114
161
  version_requirements: *id009
115
162
  - !ruby/object:Gem::Dependency
116
- name: yard
117
163
  requirement: &id010 !ruby/object:Gem::Requirement
118
164
  none: false
119
165
  requirements:
120
166
  - - ~>
121
167
  - !ruby/object:Gem::Version
168
+ hash: 9
169
+ segments:
170
+ - 0
171
+ - 6
172
+ - 7
122
173
  version: 0.6.7
123
174
  type: :development
175
+ name: yard
124
176
  prerelease: false
125
177
  version_requirements: *id010
126
178
  - !ruby/object:Gem::Dependency
127
- name: jeweler
128
179
  requirement: &id011 !ruby/object:Gem::Requirement
129
180
  none: false
130
181
  requirements:
131
182
  - - ~>
132
183
  - !ruby/object:Gem::Version
184
+ hash: 7
185
+ segments:
186
+ - 1
187
+ - 5
188
+ - 2
133
189
  version: 1.5.2
134
190
  type: :development
191
+ name: jeweler
135
192
  prerelease: false
136
193
  version_requirements: *id011
137
194
  - !ruby/object:Gem::Dependency
138
- name: rspec
139
195
  requirement: &id012 !ruby/object:Gem::Requirement
140
196
  none: false
141
197
  requirements:
142
198
  - - ~>
143
199
  - !ruby/object:Gem::Version
200
+ hash: 27
201
+ segments:
202
+ - 2
203
+ - 5
204
+ - 0
144
205
  version: 2.5.0
145
206
  type: :development
207
+ name: rspec
146
208
  prerelease: false
147
209
  version_requirements: *id012
148
210
  - !ruby/object:Gem::Dependency
149
- name: rcov
150
211
  requirement: &id013 !ruby/object:Gem::Requirement
151
212
  none: false
152
213
  requirements:
153
214
  - - ">="
154
215
  - !ruby/object:Gem::Version
216
+ hash: 41
217
+ segments:
218
+ - 0
219
+ - 9
220
+ - 9
155
221
  version: 0.9.9
156
222
  type: :development
223
+ name: rcov
157
224
  prerelease: false
158
225
  version_requirements: *id013
159
226
  - !ruby/object:Gem::Dependency
160
- name: spork
161
227
  requirement: &id014 !ruby/object:Gem::Requirement
162
228
  none: false
163
229
  requirements:
164
230
  - - ~>
165
231
  - !ruby/object:Gem::Version
232
+ hash: 977940482
233
+ segments:
234
+ - 0
235
+ - 9
236
+ - 0
237
+ - rc5
166
238
  version: 0.9.0.rc5
167
239
  type: :development
240
+ name: spork
168
241
  prerelease: false
169
242
  version_requirements: *id014
170
243
  - !ruby/object:Gem::Dependency
171
- name: watchr
172
244
  requirement: &id015 !ruby/object:Gem::Requirement
173
245
  none: false
174
246
  requirements:
175
247
  - - ">="
176
248
  - !ruby/object:Gem::Version
249
+ hash: 3
250
+ segments:
251
+ - 0
177
252
  version: "0"
178
253
  type: :development
254
+ name: watchr
179
255
  prerelease: false
180
256
  version_requirements: *id015
181
257
  description: "Gorillib: infochimps lightweight subset of ruby convenience methods"
@@ -316,7 +392,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
316
392
  requirements:
317
393
  - - ">="
318
394
  - !ruby/object:Gem::Version
319
- hash: 1350507123130852997
395
+ hash: 3
320
396
  segments:
321
397
  - 0
322
398
  version: "0"
@@ -325,11 +401,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
325
401
  requirements:
326
402
  - - ">="
327
403
  - !ruby/object:Gem::Version
404
+ hash: 3
405
+ segments:
406
+ - 0
328
407
  version: "0"
329
408
  requirements: []
330
409
 
331
410
  rubyforge_project:
332
- rubygems_version: 1.5.0
411
+ rubygems_version: 1.3.7
333
412
  signing_key:
334
413
  specification_version: 3
335
414
  summary: include only what you need. No dependencies, no creep