o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1336655370.734724: @value"r{I" class:EFI"ProcessedAsset;FI"logical_path;F"batman/batman.rails.jsI" pathname;F"z/Users/vincent/.rvm/gems/ruby-1.9.3-p125/gems/batman-rails-0.0.5/vendor/assets/javascripts/batman/batman.rails.coffeeI"content_type;FI"application/javascript;FI" mtime;FI"2012-04-23T13:04:25+01:00;FI" length;FiøI" digest;F"%dc67bf0449cd054fe70e378d40ab1374I" source;FI"ø(function() { var applyExtra, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; applyExtra = function(Batman) { var buildParams, date_re, numericKeys, param, r20, rbracket; rbracket = /\[\]$/; r20 = /%20/g; param = function(a) { var add, k, name, s, v, value; if (typeof a === 'string') { return a; } s = []; add = function(key, value) { if (typeof value === 'function') { value = value(); } if (value == null) { value = ''; } return s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value); }; if (Batman.typeOf(a) === 'Array') { for (value in a) { name = a[value]; add(name, value); } } else { for (k in a) { if (!__hasProp.call(a, k)) continue; v = a[k]; buildParams(k, v, add); } } return s.join("&").replace(r20, "+"); }; buildParams = function(prefix, obj, add) { var i, name, v, _i, _len, _results, _results1; if (Batman.typeOf(obj) === 'Array') { _results = []; for (i = _i = 0, _len = obj.length; _i < _len; i = ++_i) { v = obj[i]; if (rbracket.test(prefix)) { _results.push(add(prefix, v)); } else { _results.push(buildParams(prefix + "[]", v, add)); } } return _results; } else if ((obj != null) && typeof obj === "object") { _results1 = []; for (name in obj) { _results1.push(buildParams(prefix + "[" + name + "]", obj[name], add)); } return _results1; } else { return add(prefix, obj); } }; numericKeys = [1, 2, 3, 4, 5, 6, 7, 10, 11]; date_re = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/; Batman.mixin(Batman.Encoders, { railsDate: { defaultTimezoneOffset: (new Date()).getTimezoneOffset(), encode: function(value) { return value; }, decode: function(value) { var key, minutesOffset, obj, _i, _len; if (value != null) { if ((obj = date_re.exec(value))) { for (_i = 0, _len = numericKeys.length; _i < _len; _i++) { key = numericKeys[_i]; obj[key] = +obj[key] || 0; } obj[2] = (+obj[2] || 1) - 1; obj[3] = +obj[3] || 1; if (obj[8] !== "Z" && obj[9] !== void 0) { minutesOffset = obj[10] * 60 + obj[11]; if (obj[9] === "+") { minutesOffset = 0 - minutesOffset; } } else { minutesOffset = Batman.Encoders.railsDate.defaultTimezoneOffset; } return new Date(Date.UTC(obj[1], obj[2], obj[3], obj[4], obj[5] + minutesOffset, obj[6], obj[7])); } else { Batman.developer.warn("Unrecognized rails date " + value + "!"); return Date.parse(value); } } } } }); return Batman.RailsStorage = (function(_super) { __extends(RailsStorage, _super); RailsStorage.name = 'RailsStorage'; function RailsStorage() { return RailsStorage.__super__.constructor.apply(this, arguments); } RailsStorage.prototype._serializeToFormData = function(data) { return param(data); }; RailsStorage.prototype.urlForRecord = function() { return this._addJsonExtension(RailsStorage.__super__.urlForRecord.apply(this, arguments)); }; RailsStorage.prototype.urlForCollection = function() { return this._addJsonExtension(RailsStorage.__super__.urlForCollection.apply(this, arguments)); }; RailsStorage.prototype._addJsonExtension = function(url) { if (url.indexOf('?') !== -1 || url.substr(-5, 5) === '.json') { return url; } return url + '.json'; }; RailsStorage.prototype._errorsFrom422Response = function(response) { return JSON.parse(response); }; RailsStorage.prototype.before('update', 'create', function(env, next) { if (this.serializeAsForm && !Batman.Request.dataHasFileUploads(env.options.data)) { env.options.data = this._serializeToFormData(env.options.data); } return next(); }); RailsStorage.prototype.after('update', 'create', function(_arg, next) { var env, error, errorsArray, key, record, response, validationError, validationErrors, _i, _len, _ref; error = _arg.error, record = _arg.record, response = _arg.response; env = arguments[0]; if (error) { if (((_ref = error.request) != null ? _ref.get('status') : void 0) === 422) { try { validationErrors = this._errorsFrom422Response(response); } catch (extractionError) { env.error = extractionError; return next(); } for (key in validationErrors) { errorsArray = validationErrors[key]; for (_i = 0, _len = errorsArray.length; _i < _len; _i++) { validationError = errorsArray[_i]; record.get('errors').add(key, validationError); } } env.result = record; env.error = record.get('errors'); return next(); } } return next(); }); return RailsStorage; })(Batman.RestStorage); }; if ((typeof module !== "undefined" && module !== null) && (typeof require !== "undefined" && require !== null)) { module.exports = applyExtra; } else { applyExtra(Batman); } }).call(this); ;TI"dependency_digest;F"%1dc59afa817e03c80a85d0c8c47d2dccI"required_paths;F["z/Users/vincent/.rvm/gems/ruby-1.9.3-p125/gems/batman-rails-0.0.5/vendor/assets/javascripts/batman/batman.rails.coffeeI"dependency_paths;F[{I" path;F"z/Users/vincent/.rvm/gems/ruby-1.9.3-p125/gems/batman-rails-0.0.5/vendor/assets/javascripts/batman/batman.rails.coffeeI" mtime;FI"2012-04-23T13:04:25+01:00;FI" digest;F"%994f156fbc2a1f6abd3f6e464880a3c4I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862