yellow-brick-road 0.2.2 → 0.2.3

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.
Files changed (34) hide show
  1. data/README.rst +9 -1
  2. data/Rakefile +0 -3
  3. data/lib/generators/templates/yellow_brick_road.rb.erb +12 -0
  4. data/lib/tasks/ybr.rake +12 -0
  5. data/lib/yellow-brick-road.rb +5 -0
  6. data/lib/yellow-brick-road/config.rb +45 -6
  7. data/lib/yellow-brick-road/directive_processor.rb +89 -10
  8. data/lib/yellow-brick-road/engine.rb +10 -0
  9. data/lib/yellow-brick-road/protobuf_js.rb +32 -0
  10. data/lib/yellow-brick-road/soy_processor.rb +13 -4
  11. data/lib/yellow-brick-road/utils.rb +7 -1
  12. data/lib/yellow-brick-road/version.rb +1 -1
  13. data/test/dummy/app/assets/javascripts/application.js +1 -0
  14. data/test/dummy/app/assets/javascripts/closure-deps.js +2 -1
  15. data/test/dummy/app/assets/javascripts/protos/person.pb.js +207 -0
  16. data/test/dummy/app/protos/person.proto +5 -0
  17. data/test/dummy/log/development.log +1544 -0
  18. data/test/dummy/tmp/cache/assets/C5B/240/sprockets%2Fc561864da49634b1e8464990f63f4123 +314 -0
  19. data/test/dummy/tmp/cache/assets/C7E/9F0/sprockets%2F89862076204c62c4593ac20de32da909 +6 -5
  20. data/test/dummy/tmp/cache/assets/CBD/850/sprockets%2F9191c7b83dca8e9342628ac59e452229 +297 -0
  21. data/test/dummy/tmp/cache/assets/CCC/BB0/sprockets%2F649c7cc1e706997576646e6dd790d7a0 +0 -0
  22. data/test/dummy/tmp/cache/assets/CE0/AB0/sprockets%2Fb8f01070d8f72dd30306684ef61858ac +204 -0
  23. data/test/dummy/tmp/cache/assets/CF7/BC0/sprockets%2Fe47129798756fd8f35bd4350bff5e461 +213 -0
  24. data/test/dummy/tmp/cache/assets/D15/F60/sprockets%2Fa28394e3f80365b5bc86794dd46daa22 +0 -0
  25. data/test/dummy/tmp/cache/assets/D50/F20/sprockets%2Fd858e852254b667a8efffa4f12d96d11 +0 -0
  26. data/test/dummy/tmp/cache/assets/D6B/0C0/sprockets%2F8c3bdd9c000f7f5a26e91f294a71c3c4 +0 -0
  27. data/test/dummy/tmp/cache/assets/D6F/6D0/sprockets%2Ff9f65ec20235e6595b5eb2ab91f15bb4 +1441 -0
  28. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +7 -5
  29. data/test/dummy/tmp/cache/assets/D97/E60/sprockets%2F18762119fe3a03903efaac2bfceec628 +763 -0
  30. data/test/dummy/tmp/cache/assets/DA1/670/sprockets%2Fccb4ba5dcd2f7696c636666ca5ab6057 +60 -0
  31. data/test/dummy/tmp/cache/assets/DED/040/sprockets%2Fd3aa2ab8d25cde3b6fb324dbb8c42933 +746 -0
  32. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  33. metadata +38 -11
  34. data/lib/tasks/yellow-brick-road_tasks.rake +0 -4
@@ -1,6 +1,6 @@
1
- o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325729945.666527: @value{ I" length:EFi��I" digest;
2
- F"%b95339cd0198624d0afeea4ba8c9e630I" source;
3
- FI"��/*!
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1326429782.034936: @value{ I" length:EFi_�I" digest;
2
+ F"%1ecaad05bdfab03762b3d5d070f5e1e7I" source;
3
+ FI"_�/*!
4
4
  * jQuery JavaScript Library v1.7.1
5
5
  * http://jquery.com/
6
6
  *
@@ -11168,7 +11168,8 @@ goog.scope = function(fn) {
11168
11168
  // This file was autogenerated by /Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/bin/build/depswriter.py.
11169
11169
  // Please do not edit.
11170
11170
  goog.addDependency('../../my-closure/start.js', ['myproject.start'], ['goog.dom', 'myproject.templates']);
11171
- goog.addDependency('/soyutils_usegoog.js', ['soy', 'soy.StringBuilder', 'soy.esc', 'soydata', 'soydata.SanitizedHtml', 'soydata.SanitizedHtmlAttribute', 'soydata.SanitizedJsStrChars', 'soydata.SanitizedUri'], ['goog.asserts', 'goog.dom.DomHelper', 'goog.format', 'goog.i18n.BidiFormatter', 'goog.i18n.bidi', 'goog.soy', 'goog.string', 'goog.string.StringBuffer']);
11171
+ goog.addDependency('../../protos/person.pb.js', ['Person'], ['goog.proto2.Message']);
11172
+ goog.addDependency('/../../../soyutils_usegoog.js', ['soy', 'soy.StringBuilder', 'soy.esc', 'soydata', 'soydata.SanitizedHtml', 'soydata.SanitizedHtmlAttribute', 'soydata.SanitizedJsStrChars', 'soydata.SanitizedUri'], ['goog.asserts', 'goog.dom.DomHelper', 'goog.format', 'goog.i18n.BidiFormatter', 'goog.i18n.bidi', 'goog.soy', 'goog.string', 'goog.string.StringBuffer']);
11172
11173
  // This file was automatically generated from simple.js.soy.
11173
11174
  // Please don't edit this file by hand.
11174
11175
 
@@ -11221,7 +11222,8 @@ goog.exportSymbol('myproject.start', myproject.start);
11221
11222
  // the compiled file.
11222
11223
  //
11223
11224
  //
11225
+
11224
11226
  ;
11225
11227
  ;
11226
11228
  FI"
11227
- F"%6c02e0110e226e2af7f02b790ff7689e
11229
+ F"%5b19b635c4425648c8ea793118ba6412
@@ -0,0 +1,763 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1326427868.347023: @value{I"
2
+ class:EFI"BundledAsset;
3
+ FI"id;
4
+ F"%dc32e8cbd1c3a4a04d28db2bd5d26767I"logical_path;
5
+ FI"#closure/goog/proto2/message.js;
6
+ TI"
7
+ F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/proto2/message.jsI"content_type;
8
+ FI"application/javascript;
9
+ FI"
10
+ mtime;
11
+ FI"2012-01-03T00:52:24+00:00;
12
+ FI" body;
13
+ FI"�Q// Copyright 2008 The Closure Library Authors. All Rights Reserved.
14
+ //
15
+ // Licensed under the Apache License, Version 2.0 (the "License");
16
+ // you may not use this file except in compliance with the License.
17
+ // You may obtain a copy of the License at
18
+ //
19
+ // http://www.apache.org/licenses/LICENSE-2.0
20
+ //
21
+ // Unless required by applicable law or agreed to in writing, software
22
+ // distributed under the License is distributed on an "AS-IS" BASIS,
23
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ // See the License for the specific language governing permissions and
25
+ // limitations under the License.
26
+
27
+ /**
28
+ * @fileoverview Protocol Buffer Message base class.
29
+ */
30
+
31
+
32
+ goog.provide('goog.proto2.Message');
33
+
34
+ goog.require('goog.proto2.Descriptor');
35
+ goog.require('goog.proto2.FieldDescriptor');
36
+ goog.require('goog.proto2.Util');
37
+ goog.require('goog.string');
38
+
39
+
40
+
41
+ /**
42
+ * Abstract base class for all Protocol Buffer 2 messages. It will be
43
+ * subclassed in the code generated by the Protocol Compiler. Any other
44
+ * subclasses are prohibited.
45
+ * @constructor
46
+ */
47
+ goog.proto2.Message = function() {
48
+ /**
49
+ * Stores the field values in this message.
50
+ * @type {*}
51
+ * @private
52
+ */
53
+ this.values_ = {};
54
+
55
+ // The descriptor_ is static to the message function that is being created.
56
+ // Therefore, we retrieve it via the constructor.
57
+
58
+ /**
59
+ * Stores the information (i.e. metadata) about this message.
60
+ * @type {!goog.proto2.Descriptor}
61
+ * @private
62
+ */
63
+ this.descriptor_ = this.constructor.descriptor_;
64
+
65
+ /**
66
+ * Stores the field information (i.e. metadata) about this message.
67
+ * @type {Object.<number, !goog.proto2.FieldDescriptor>}
68
+ * @private
69
+ */
70
+ this.fields_ = this.descriptor_.getFieldsMap();
71
+
72
+ /**
73
+ * The lazy deserializer for this message instance, if any.
74
+ * @type {goog.proto2.LazyDeserializer}
75
+ * @private
76
+ */
77
+ this.lazyDeserializer_ = null;
78
+
79
+ /**
80
+ * A map of those fields deserialized.
81
+ * @type {Object}
82
+ * @private
83
+ */
84
+ this.deserializedFields_ = null;
85
+ };
86
+
87
+
88
+ /**
89
+ * An enumeration defining the possible field types.
90
+ * Should be a mirror of that defined in descriptor.h.
91
+ *
92
+ * TODO(user): Remove this alias. The code generator generates code that
93
+ * references this enum, so it needs to exist until the code generator is
94
+ * changed. The enum was moved to from Message to FieldDescriptor to avoid a
95
+ * dependency cycle.
96
+ *
97
+ * Use goog.proto2.FieldDescriptor.FieldType instead.
98
+ *
99
+ * @enum {number}
100
+ */
101
+ goog.proto2.Message.FieldType = {
102
+ DOUBLE: 1,
103
+ FLOAT: 2,
104
+ INT64: 3,
105
+ UINT64: 4,
106
+ INT32: 5,
107
+ FIXED64: 6,
108
+ FIXED32: 7,
109
+ BOOL: 8,
110
+ STRING: 9,
111
+ GROUP: 10,
112
+ MESSAGE: 11,
113
+ BYTES: 12,
114
+ UINT32: 13,
115
+ ENUM: 14,
116
+ SFIXED32: 15,
117
+ SFIXED64: 16,
118
+ SINT32: 17,
119
+ SINT64: 18
120
+ };
121
+
122
+
123
+ /**
124
+ * Initializes the message with a lazy deserializer and its associated data.
125
+ * This method should be called by internal methods ONLY.
126
+ *
127
+ * @param {goog.proto2.LazyDeserializer} deserializer The lazy deserializer to
128
+ * use to decode the data on the fly.
129
+ *
130
+ * @param {*} data The data to decode/deserialize.
131
+ */
132
+ goog.proto2.Message.prototype.initializeForLazyDeserializer = function(
133
+ deserializer, data) {
134
+
135
+ this.lazyDeserializer_ = deserializer;
136
+ this.values_ = data;
137
+ this.deserializedFields_ = {};
138
+ };
139
+
140
+
141
+ /**
142
+ * Sets the value of an unknown field, by tag.
143
+ *
144
+ * @param {number} tag The tag of an unknown field (must be >= 1).
145
+ * @param {*} value The value for that unknown field.
146
+ */
147
+ goog.proto2.Message.prototype.setUnknown = function(tag, value) {
148
+ goog.proto2.Util.assert(!this.fields_[tag],
149
+ 'Field is not unknown in this message');
150
+
151
+ goog.proto2.Util.assert(tag >= 1, 'Tag is not valid');
152
+ goog.proto2.Util.assert(value !== null, 'Value cannot be null');
153
+
154
+ this.values_[tag] = value;
155
+ };
156
+
157
+
158
+ /**
159
+ * Iterates over all the unknown fields in the message.
160
+ *
161
+ * @param {function(number, *)} callback A callback method
162
+ * which gets invoked for each unknown field.
163
+ * @param {Object=} opt_scope The scope under which to execute the callback.
164
+ * If not given, the current message will be used.
165
+ */
166
+ goog.proto2.Message.prototype.forEachUnknown = function(callback, opt_scope) {
167
+ var scope = opt_scope || this;
168
+ for (var key in this.values_) {
169
+ if (!this.fields_[/** @type {number} */ (key)]) {
170
+ callback.call(scope, Number(key), this.values_[key]);
171
+ }
172
+ }
173
+ };
174
+
175
+
176
+ /**
177
+ * Returns the descriptor which describes the current message.
178
+ *
179
+ * @return {goog.proto2.Descriptor} The descriptor.
180
+ */
181
+ goog.proto2.Message.prototype.getDescriptor = function() {
182
+ return this.descriptor_;
183
+ };
184
+
185
+
186
+ /**
187
+ * Returns whether there is a value stored at the field specified by the
188
+ * given field descriptor.
189
+ *
190
+ * @param {goog.proto2.FieldDescriptor} field The field for which to check
191
+ * if there is a value.
192
+ *
193
+ * @return {boolean} True if a value was found.
194
+ */
195
+ goog.proto2.Message.prototype.has = function(field) {
196
+ goog.proto2.Util.assert(
197
+ field.getContainingType() == this.descriptor_,
198
+ 'The current message does not contain the given field');
199
+
200
+ return this.has$Value(field.getTag());
201
+ };
202
+
203
+
204
+ /**
205
+ * Returns the array of values found for the given repeated field.
206
+ *
207
+ * @param {goog.proto2.FieldDescriptor} field The field for which to
208
+ * return the values.
209
+ *
210
+ * @return {!Array} The values found.
211
+ */
212
+ goog.proto2.Message.prototype.arrayOf = function(field) {
213
+ goog.proto2.Util.assert(
214
+ field.getContainingType() == this.descriptor_,
215
+ 'The current message does not contain the given field');
216
+
217
+ return this.array$Values(field.getTag());
218
+ };
219
+
220
+
221
+ /**
222
+ * Returns the number of values stored in the given field.
223
+ *
224
+ * @param {goog.proto2.FieldDescriptor} field The field for which to count
225
+ * the number of values.
226
+ *
227
+ * @return {number} The count of the values in the given field.
228
+ */
229
+ goog.proto2.Message.prototype.countOf = function(field) {
230
+ goog.proto2.Util.assert(
231
+ field.getContainingType() == this.descriptor_,
232
+ 'The current message does not contain the given field');
233
+
234
+ return this.count$Values(field.getTag());
235
+ };
236
+
237
+
238
+ /**
239
+ * Returns the value stored at the field specified by the
240
+ * given field descriptor.
241
+ *
242
+ * @param {goog.proto2.FieldDescriptor} field The field for which to get the
243
+ * value.
244
+ * @param {number=} opt_index If the field is repeated, the index to use when
245
+ * looking up the value.
246
+ *
247
+ * @return {*} The value found or null if none.
248
+ */
249
+ goog.proto2.Message.prototype.get = function(field, opt_index) {
250
+ goog.proto2.Util.assert(
251
+ field.getContainingType() == this.descriptor_,
252
+ 'The current message does not contain the given field');
253
+
254
+ return this.get$Value(field.getTag(), opt_index);
255
+ };
256
+
257
+
258
+ /**
259
+ * Returns the value stored at the field specified by the
260
+ * given field descriptor or the default value if none exists.
261
+ *
262
+ * @param {goog.proto2.FieldDescriptor} field The field for which to get the
263
+ * value.
264
+ * @param {number=} opt_index If the field is repeated, the index to use when
265
+ * looking up the value.
266
+ *
267
+ * @return {*} The value found or the default if none.
268
+ */
269
+ goog.proto2.Message.prototype.getOrDefault = function(field, opt_index) {
270
+ goog.proto2.Util.assert(
271
+ field.getContainingType() == this.descriptor_,
272
+ 'The current message does not contain the given field');
273
+
274
+ return this.get$ValueOrDefault(field.getTag(), opt_index);
275
+ };
276
+
277
+
278
+ /**
279
+ * Stores the given value to the field specified by the
280
+ * given field descriptor. Note that the field must not be repeated.
281
+ *
282
+ * @param {goog.proto2.FieldDescriptor} field The field for which to set
283
+ * the value.
284
+ * @param {*} value The new value for the field.
285
+ */
286
+ goog.proto2.Message.prototype.set = function(field, value) {
287
+ goog.proto2.Util.assert(
288
+ field.getContainingType() == this.descriptor_,
289
+ 'The current message does not contain the given field');
290
+
291
+ this.set$Value(field.getTag(), value);
292
+ };
293
+
294
+
295
+ /**
296
+ * Adds the given value to the field specified by the
297
+ * given field descriptor. Note that the field must be repeated.
298
+ *
299
+ * @param {goog.proto2.FieldDescriptor} field The field in which to add the
300
+ * the value.
301
+ * @param {*} value The new value to add to the field.
302
+ */
303
+ goog.proto2.Message.prototype.add = function(field, value) {
304
+ goog.proto2.Util.assert(
305
+ field.getContainingType() == this.descriptor_,
306
+ 'The current message does not contain the given field');
307
+
308
+ this.add$Value(field.getTag(), value);
309
+ };
310
+
311
+
312
+ /**
313
+ * Clears the field specified.
314
+ *
315
+ * @param {goog.proto2.FieldDescriptor} field The field to clear.
316
+ */
317
+ goog.proto2.Message.prototype.clear = function(field) {
318
+ goog.proto2.Util.assert(
319
+ field.getContainingType() == this.descriptor_,
320
+ 'The current message does not contain the given field');
321
+
322
+ this.clear$Field(field.getTag());
323
+ };
324
+
325
+
326
+ /**
327
+ * Compares this message with another one ignoring the unknown fields.
328
+ * @param {*} other The other message.
329
+ * @return {boolean} Whether they are equal. Returns false if the {@code other}
330
+ * argument is a different type of message or not a message.
331
+ */
332
+ goog.proto2.Message.prototype.equals = function(other) {
333
+ if (!other || this.constructor != other.constructor) {
334
+ return false;
335
+ }
336
+
337
+ var fields = this.getDescriptor().getFields();
338
+ for (var i = 0; i < fields.length; i++) {
339
+ var field = fields[i];
340
+ if (this.has(field) != other.has(field)) {
341
+ return false;
342
+ }
343
+
344
+ if (this.has(field)) {
345
+ var isComposite = field.isCompositeType();
346
+
347
+ function fieldsEqual(value1, value2) {
348
+ return isComposite ? value1.equals(value2) : value1 == value2;
349
+ }
350
+
351
+ var tag = field.getTag();
352
+ var thisValue = this.values_[tag];
353
+ var otherValue = other.values_[tag];
354
+
355
+ if (field.isRepeated()) {
356
+ // In this case thisValue and otherValue are arrays.
357
+ if (thisValue.length != otherValue.length) {
358
+ return false;
359
+ }
360
+ for (var j = 0; j < thisValue.length; j++) {
361
+ if (!fieldsEqual(thisValue[j], otherValue[j])) {
362
+ return false;
363
+ }
364
+ }
365
+ } else if (!fieldsEqual(thisValue, otherValue)) {
366
+ return false;
367
+ }
368
+ }
369
+ }
370
+
371
+ return true;
372
+ };
373
+
374
+
375
+ /**
376
+ * Recursively copies the known fields from the given message to this message.
377
+ * Removes the fields which are not present in the source message.
378
+ * @param {!goog.proto2.Message} message The source message.
379
+ */
380
+ goog.proto2.Message.prototype.copyFrom = function(message) {
381
+ goog.proto2.Util.assert(this.constructor == message.constructor,
382
+ 'The source message must have the same type.');
383
+ var fields = this.getDescriptor().getFields();
384
+
385
+ for (var i = 0; i < fields.length; i++) {
386
+ var field = fields[i];
387
+ delete this.values_[field.getTag()];
388
+
389
+ if (message.has(field)) {
390
+ var isComposite = field.isCompositeType();
391
+ if (field.isRepeated()) {
392
+ var values = message.arrayOf(field);
393
+ for (var j = 0; j < values.length; j++) {
394
+ this.add(field, isComposite ? values[j].clone() : values[j]);
395
+ }
396
+ } else {
397
+ var value = message.get(field);
398
+ this.set(field, isComposite ? value.clone() : value);
399
+ }
400
+ }
401
+ }
402
+ };
403
+
404
+
405
+ /**
406
+ * @return {!goog.proto2.Message} Recursive clone of the message only including
407
+ * the known fields.
408
+ */
409
+ goog.proto2.Message.prototype.clone = function() {
410
+ var clone = new this.constructor;
411
+ clone.copyFrom(this);
412
+ return clone;
413
+ };
414
+
415
+
416
+ /**
417
+ * Fills in the protocol buffer with default values. Any fields that are
418
+ * already set will not be overridden.
419
+ * @param {boolean} simpleFieldsToo If true, all fields will be initialized;
420
+ * if false, only the nested messages and groups.
421
+ */
422
+ goog.proto2.Message.prototype.initDefaults = function(simpleFieldsToo) {
423
+ var fields = this.getDescriptor().getFields();
424
+ for (var i = 0; i < fields.length; i++) {
425
+ var field = fields[i];
426
+ var tag = field.getTag();
427
+ var isComposite = field.isCompositeType();
428
+
429
+ // Initialize missing fields.
430
+ if (!this.has(field) && !field.isRepeated()) {
431
+ if (isComposite) {
432
+ this.values_[tag] = new /** @type {Function} */ (field.getNativeType());
433
+ } else if (simpleFieldsToo) {
434
+ this.values_[tag] = field.getDefaultValue();
435
+ }
436
+ }
437
+
438
+ // Fill in the existing composite fields recursively.
439
+ if (isComposite) {
440
+ if (field.isRepeated()) {
441
+ var values = this.array$Values(tag);
442
+ for (var j = 0; j < values.length; j++) {
443
+ values[j].initDefaults(simpleFieldsToo);
444
+ }
445
+ } else {
446
+ this.get$Value(tag).initDefaults(simpleFieldsToo);
447
+ }
448
+ }
449
+ }
450
+ };
451
+
452
+
453
+ /**
454
+ * Returns the field in this message by the given tag number. If no
455
+ * such field exists, throws an exception.
456
+ *
457
+ * @param {number} tag The field's tag index.
458
+ * @return {!goog.proto2.FieldDescriptor} The descriptor for the field.
459
+ * @private
460
+ */
461
+ goog.proto2.Message.prototype.getFieldByTag_ = function(tag) {
462
+ goog.proto2.Util.assert(this.fields_[tag],
463
+ 'No field found for the given tag');
464
+
465
+ return this.fields_[tag];
466
+ };
467
+
468
+
469
+ /**
470
+ * Returns the whether or not the field indicated by the given tag
471
+ * has a value.
472
+ *
473
+ * GENERATED CODE USE ONLY. Basis of the has{Field} methods.
474
+ *
475
+ * @param {number} tag The tag.
476
+ *
477
+ * @return {boolean} Whether the message has a value for the field.
478
+ */
479
+ goog.proto2.Message.prototype.has$Value = function(tag) {
480
+ goog.proto2.Util.assert(this.fields_[tag],
481
+ 'No field found for the given tag');
482
+
483
+ return tag in this.values_ && goog.isDef(this.values_[tag]) &&
484
+ this.values_[tag] !== null;
485
+ };
486
+
487
+
488
+ /**
489
+ * If a lazy deserializer is instantiated, lazily deserializes the
490
+ * field if required.
491
+ *
492
+ * @param {goog.proto2.FieldDescriptor} field The field.
493
+ * @private
494
+ */
495
+ goog.proto2.Message.prototype.lazyDeserialize_ = function(field) {
496
+ // If we have a lazy deserializer, then ensure that the field is
497
+ // properly deserialized.
498
+ if (this.lazyDeserializer_) {
499
+ var tag = field.getTag();
500
+
501
+ if (!(tag in this.deserializedFields_)) {
502
+ this.values_[tag] = this.lazyDeserializer_.deserializeField(
503
+ this, field, this.values_[tag]);
504
+
505
+ this.deserializedFields_[tag] = true;
506
+ }
507
+ }
508
+ };
509
+
510
+
511
+ /**
512
+ * Gets the value at the field indicated by the given tag.
513
+ *
514
+ * GENERATED CODE USE ONLY. Basis of the get{Field} methods.
515
+ *
516
+ * @param {number} tag The field's tag index.
517
+ * @param {number=} opt_index If the field is a repeated field, the index
518
+ * at which to get the value.
519
+ *
520
+ * @return {*} The value found or null for none.
521
+ * @protected
522
+ */
523
+ goog.proto2.Message.prototype.get$Value = function(tag, opt_index) {
524
+ var field = this.getFieldByTag_(tag);
525
+
526
+ // Ensure that the field is deserialized.
527
+ this.lazyDeserialize_(field);
528
+
529
+ if (field.isRepeated()) {
530
+ var index = opt_index || 0;
531
+ goog.proto2.Util.assert(index >= 0 && index < this.count$Values(tag),
532
+ 'Given index is out of bounds');
533
+
534
+ return this.values_[tag][index];
535
+ } else {
536
+ goog.proto2.Util.assert(!goog.isArray(this.values_[tag]));
537
+ return tag in this.values_ ? this.values_[tag] : null;
538
+ }
539
+ };
540
+
541
+
542
+ /**
543
+ * Gets the value at the field indicated by the given tag or the default value
544
+ * if none.
545
+ *
546
+ * GENERATED CODE USE ONLY. Basis of the get{Field} methods.
547
+ *
548
+ * @param {number} tag The field's tag index.
549
+ * @param {number=} opt_index If the field is a repeated field, the index
550
+ * at which to get the value.
551
+ *
552
+ * @return {*} The value found or the default value if none set.
553
+ * @protected
554
+ */
555
+ goog.proto2.Message.prototype.get$ValueOrDefault = function(tag, opt_index) {
556
+
557
+ if (!this.has$Value(tag)) {
558
+ // Return the default value.
559
+ var field = this.getFieldByTag_(tag);
560
+ return field.getDefaultValue();
561
+ }
562
+
563
+ return this.get$Value(tag, opt_index);
564
+ };
565
+
566
+
567
+ /**
568
+ * Gets the values at the field indicated by the given tag.
569
+ *
570
+ * GENERATED CODE USE ONLY. Basis of the {field}Array methods.
571
+ *
572
+ * @param {number} tag The field's tag index.
573
+ *
574
+ * @return {!Array} The values found. If none, returns an empty array.
575
+ * @protected
576
+ */
577
+ goog.proto2.Message.prototype.array$Values = function(tag) {
578
+ goog.proto2.Util.assert(this.getFieldByTag_(tag).isRepeated(),
579
+ 'Cannot call fieldArray on a non-repeated field');
580
+
581
+ var field = this.getFieldByTag_(tag);
582
+
583
+ // Ensure that the field is deserialized.
584
+ this.lazyDeserialize_(field);
585
+
586
+ return this.values_[tag] || [];
587
+ };
588
+
589
+
590
+ /**
591
+ * Returns the number of values stored in the field by the given tag.
592
+ *
593
+ * GENERATED CODE USE ONLY. Basis of the {field}Count methods.
594
+ *
595
+ * @param {number} tag The tag.
596
+ *
597
+ * @return {number} The number of values.
598
+ * @protected
599
+ */
600
+ goog.proto2.Message.prototype.count$Values = function(tag) {
601
+ var field = this.getFieldByTag_(tag);
602
+
603
+ if (field.isRepeated()) {
604
+ if (this.has$Value(tag)) {
605
+ goog.proto2.Util.assert(goog.isArray(this.values_[tag]));
606
+ }
607
+
608
+ return this.has$Value(tag) ? this.values_[tag].length : 0;
609
+ } else {
610
+ return this.has$Value(tag) ? 1 : 0;
611
+ }
612
+ };
613
+
614
+
615
+ /**
616
+ * Sets the value of the *non-repeating* field indicated by the given tag.
617
+ *
618
+ * GENERATED CODE USE ONLY. Basis of the set{Field} methods.
619
+ *
620
+ * @param {number} tag The field's tag index.
621
+ * @param {*} value The field's value.
622
+ * @protected
623
+ */
624
+ goog.proto2.Message.prototype.set$Value = function(tag, value) {
625
+ if (goog.proto2.Util.conductChecks()) {
626
+ var field = this.getFieldByTag_(tag);
627
+
628
+ goog.proto2.Util.assert(!field.isRepeated(),
629
+ 'Cannot call set on a repeated field');
630
+
631
+ this.checkFieldType_(field, value);
632
+ }
633
+
634
+ this.values_[tag] = value;
635
+ if (this.deserializedFields_) {
636
+ this.deserializedFields_[tag] = true;
637
+ }
638
+ };
639
+
640
+
641
+ /**
642
+ * Adds the value to the *repeating* field indicated by the given tag.
643
+ *
644
+ * GENERATED CODE USE ONLY. Basis of the add{Field} methods.
645
+ *
646
+ * @param {number} tag The field's tag index.
647
+ * @param {*} value The value to add.
648
+ * @protected
649
+ */
650
+ goog.proto2.Message.prototype.add$Value = function(tag, value) {
651
+ if (goog.proto2.Util.conductChecks()) {
652
+ var field = this.getFieldByTag_(tag);
653
+
654
+ goog.proto2.Util.assert(field.isRepeated(),
655
+ 'Cannot call add on a non-repeated field');
656
+
657
+ this.checkFieldType_(field, value);
658
+ }
659
+
660
+ if (!this.values_[tag]) {
661
+ this.values_[tag] = [];
662
+ }
663
+
664
+ this.values_[tag].push(value);
665
+ };
666
+
667
+
668
+ /**
669
+ * Ensures that the value being assigned to the given field
670
+ * is valid.
671
+ *
672
+ * @param {!goog.proto2.FieldDescriptor} field The field being assigned.
673
+ * @param {*} value The value being assigned.
674
+ * @private
675
+ */
676
+ goog.proto2.Message.prototype.checkFieldType_ = function(field, value) {
677
+ goog.proto2.Util.assert(value !== null);
678
+
679
+ var nativeType = field.getNativeType();
680
+ if (nativeType === String) {
681
+ goog.proto2.Util.assert(typeof value === 'string',
682
+ 'Expected value of type string');
683
+ } else if (nativeType === Boolean) {
684
+ goog.proto2.Util.assert(typeof value === 'boolean',
685
+ 'Expected value of type boolean');
686
+ } else if (nativeType === Number) {
687
+ goog.proto2.Util.assert(typeof value === 'number',
688
+ 'Expected value of type number');
689
+ } else if (field.getFieldType() ==
690
+ goog.proto2.FieldDescriptor.FieldType.ENUM) {
691
+ goog.proto2.Util.assert(typeof value === 'number',
692
+ 'Expected an enum value, which is a number');
693
+ } else {
694
+ goog.proto2.Util.assert(value instanceof nativeType,
695
+ 'Expected a matching message type');
696
+ }
697
+ };
698
+
699
+
700
+ /**
701
+ * Clears the field specified by tag.
702
+ *
703
+ * GENERATED CODE USE ONLY. Basis of the clear{Field} methods.
704
+ *
705
+ * @param {number} tag The tag of the field to clear.
706
+ * @protected
707
+ */
708
+ goog.proto2.Message.prototype.clear$Field = function(tag) {
709
+ goog.proto2.Util.assert(this.getFieldByTag_(tag), 'Unknown field');
710
+ delete this.values_[tag];
711
+ };
712
+
713
+
714
+ /**
715
+ * Sets the metadata that represents the definition of this message.
716
+ *
717
+ * GENERATED CODE USE ONLY. Called when constructing message classes.
718
+ *
719
+ * @param {Function} messageType Constructor for the message type to
720
+ * which this metadata applies.
721
+ * @param {Object} metadataObj The object containing the metadata.
722
+ */
723
+ goog.proto2.Message.set$Metadata = function(messageType, metadataObj) {
724
+ var fields = [];
725
+ var descriptorInfo;
726
+
727
+ for (var key in metadataObj) {
728
+ if (!metadataObj.hasOwnProperty(key)) {
729
+ continue;
730
+ }
731
+
732
+ goog.proto2.Util.assert(goog.string.isNumeric(key), 'Keys must be numeric');
733
+
734
+ if (key == 0) {
735
+ descriptorInfo = metadataObj[0];
736
+ continue;
737
+ }
738
+
739
+ // Create the field descriptor.
740
+ fields.push(
741
+ new goog.proto2.FieldDescriptor(messageType, key, metadataObj[key]));
742
+ }
743
+
744
+ goog.proto2.Util.assert(descriptorInfo);
745
+
746
+ // Create the descriptor.
747
+ messageType.descriptor_ =
748
+ new goog.proto2.Descriptor(messageType, descriptorInfo, fields);
749
+
750
+ messageType.getDescriptor = function() {
751
+ return messageType.descriptor_;
752
+ };
753
+ };
754
+ ;
755
+ FI"asset_paths;
756
+ F["�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/proto2/message.jsI"dependency_paths;
757
+ F[{I" path;
758
+ F"�/Users/ali/.rvm/gems/ruby-1.9.3-p0/bundler/gems/closure-library-wrapper-031d1d0f0e50/vendor/closure-library/closure/goog/proto2/message.jsI"
759
+ mtime;
760
+ FIu: Time
761
+ T: offsetiI"hexdigest;
762
+ F"%08d3feb1aa0da63e30f6b7852df27255I"
763
+ F"%46dde6621c301f4928e3b34efee9e3b5