Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

erb

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

erb - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

ruby/corelib-string-unpack.js

1

lib/erb/getOpalScriptWithERBTemplate.js

@@ -15,2 +15,3 @@ var Promise = require('bluebird')

'../../ruby/opal-erb.js',
'../../ruby/corelib-string-unpack.js',
'../../ruby/json.js',

@@ -17,0 +18,0 @@ '../../ruby/base64.js',

26

lib/erb/runOpalScript.js
var vm = require('vm')
function createGlobalScope () {
return {
Buffer: function (a, dec) {
this.toString = function (enc) {
return Buffer.from(a, dec).toString(enc)
}
},
console: {
log: function () {
}
},
global: {
}
function runOpalScript (timeout, opalScript) {
var context = {
Buffer: Buffer
}
}
function runOpalScript (timeout, opalScript) {
var context = createGlobalScope()
try {

@@ -27,3 +13,7 @@ vm.runInNewContext(opalScript, context, {

} catch (err) {
if (err.message === 'Script execution timed out.') {
var timeoutMessages = [
'Script execution timed out.',
'Script execution timed out after ' + timeout + 'ms'
]
if (timeoutMessages.includes(err.message)) {
throw new Error('template evaluation timed out after ' + timeout + 'ms')

@@ -30,0 +20,0 @@ } else {

@@ -1,16 +0,22 @@

/* eslint-disable */
/* global Opal */
// eslint-disable-next-line
__OPAL__
eval(global.Opal.Opal.ERB.$compile(new Buffer('__TEMPLATE__', 'base64').toString('utf8'), 'mytemplate'));
Opal.loaded(['erb', 'json', 'base64'])
var ctx = global.Opal.get('Object').$new();
var json = new Buffer('__FIELDS__', 'base64').toString('utf8');
var jsFields = JSON.parse(json);
var rubyFields = global.Opal.get('JSON').$parse(json);
var script = Opal.Opal.ERB.$compile(Buffer.from('__TEMPLATE__', 'base64').toString('utf8'), 'mytemplate')
// eslint-disable-next-line no-eval
eval(script)
var ctx = Opal.Object.$new()
var json = Buffer.from('__FIELDS__', 'base64').toString('utf8')
var jsFields = JSON.parse(json)
var rubyFields = Opal.JSON.$parse(json)
Object.keys(jsFields).forEach(function (field) {
ctx.$instance_variable_set("@" + field, rubyFields['$[]'](field));
});
ctx.$instance_variable_set('@' + field, rubyFields['$[]'](field))
})
output = global.Opal.Template['$[]']('mytemplate').$render(ctx);
/* eslint-enable */
// eslint-disable-next-line no-undef
output = Opal.Template['$[]']('mytemplate').$render(ctx)

@@ -1,2 +0,2 @@

var maxArguments = 39017
var maxArguments = 1024

@@ -3,0 +3,0 @@ function validateObject (data, key) {

{
"name": "erb",
"version": "1.3.0",
"version": "1.3.1",
"description": "Compile a given Embedded RuBy (ERB) template using variables and functions defined in given a JavaScript object",

@@ -8,6 +8,6 @@ "main": "index.js",

"lint": "eslint test/ lib/",
"build": "bundle install --path vendor/bundle && mkdir -p ruby && bundle exec opal-build base64 > ruby/base64.js && bundle exec opal-build opal/compiler > ruby/opal-compiler.js && bundle exec opal-build opal/erb > ruby/opal-erb.js && bundle exec opal-build opal > ruby/opal.js && bundle exec opal-build json > ruby/json.js && bundle exec opal-build template > ruby/template.js",
"build": "bundle install --path vendor/bundle && mkdir -p ruby && bundle exec opal-build base64 > ruby/base64.js && bundle exec opal-build opal/compiler > ruby/opal-compiler.js && bundle exec opal-build corelib/string/unpack > ruby/corelib-string-unpack.js && bundle exec opal-build --stub erb opal/erb > ruby/opal-erb.js && bundle exec opal-build opal > ruby/opal.js && bundle exec opal-build json > ruby/json.js && bundle exec opal-build template > ruby/template.js",
"posttest": "npm run lint -s",
"pretest": "npm install -s && npm run build -s",
"test": "mocha --reporter mocha-env-reporter --recursive --async-only --bail --no-exit --check-leaks --timeout 120000"
"test": "mocha --reporter mocha-env-reporter --recursive --async-only --bail --no-exit --check-leaks --timeout 15000"
},

@@ -19,3 +19,11 @@ "private": false,

},
"author": "Vytautas Jakutis",
"author": "Vytautas Jakutis <vytautas@jakut.is> (https://jakut.is/)",
"contributors": [
"Vilius Lukosius <vilius@wix.com>",
"Daniel Shmuglin <daniels@wix.com>",
"Eugene Obrezkov <ghaiklor@gmail.com> (https://ghaiklor.com)",
"Algirdas Beinaravicius <algirdasb@wix.com>",
"Gil Tayar <gilt@wix.com>",
"Kfir Bloch <kfirb@wix.com>"
],
"license": "BSD-3-Clause",

@@ -27,19 +35,19 @@ "bugs": {

"devDependencies": {
"chai": "^4.0.2",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"eslint": "^4.2.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.1.0",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^3.0.1",
"lodash": "^4.17.4",
"mocha": "^3.4.2",
"mocha-env-reporter": "^2.0.4",
"npm-version-up": "^0.1.5",
"sinon": "^2.3.6",
"sinon-chai": "^2.11.0"
"eslint": "^7.11.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"lodash": "^4.17.20",
"mocha": "^8.1.3",
"mocha-env-reporter": "^4.0.0",
"npm-version-up": "^0.1.7",
"sinon": "^9.2.0",
"sinon-chai": "^3.5.0"
},
"dependencies": {
"bluebird": "^3.5.0"
"bluebird": "^3.7.2"
},

@@ -46,0 +54,0 @@ "files": [

@@ -1,6 +0,9 @@

# erb [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![Build Status](https://travis-ci.org/wix/erb.svg?branch=master)](https://travis-ci.org/wix/erb)
# erb
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Build Status](https://travis-ci.org/wix/erb.svg?branch=master)](https://travis-ci.org/wix/erb)
Compile a given Embedded RuBy (ERB) template using variables and functions defined in given a JavaScript object.
## install
## Installation

@@ -11,3 +14,3 @@ ```bash

## usage
## Usage

@@ -17,5 +20,5 @@ Executing

```javascript
var erb = require('erb');
const erb = require('erb');
var data = {
const data = {
"fields": {

@@ -52,3 +55,3 @@ "first": "Morty",

```
```text
Morty had One Chicken Fried Steak with pattie, breaded and fried.

@@ -71,3 +74,3 @@ Rick had Two or Three Chicken Fried Steaks with pattie, breaded and fried.

## build
## Building

@@ -78,2 +81,7 @@ Requires [Bundler](http://bundler.io/).

npm run build
```
```
## Contributing
- do not do existing API-breaking changes - the test suite should remain unchanged forever, except when you add new features
- if you do a pull request, then it must have a precise title and exactly the change the title describes - otherwise do several pull requests

@@ -1,175 +0,115 @@

/* Generated by Opal 0.9.0.rc1 */
/* Generated by Opal 1.0.3 */
(function(Opal) {
Opal.dynamic_require_severity = "error";
var OPAL_CONFIG = { method_missing: true, arity_check: false, freezing: true, tainting: true };
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module;
var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $truthy = Opal.truthy;
return (function($base) {
var $Base64, self = $Base64 = $module($base, 'Base64');
Opal.add_stubs(['$raise', '$delete']);
return (function($base, $parent_nesting) {
var self = $module($base, 'Base64');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Base64_decode64$1, $Base64_encode64$2, $Base64_strict_decode64$3, $Base64_strict_encode64$4, $Base64_urlsafe_decode64$5, $Base64_urlsafe_encode64$6;
var charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
lookup = {};
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var encode, decode;
for (var i = 0, length = charset.length; i < length; i++) {
lookup[charset.charAt(i)] = i;
}
function from(string) {
var buffer = [];
for (var i = 0, length = string.length; i < length; i++) {
var a, b, c, d;
a = lookup[string.charAt(i)];
b = lookup[string.charAt(++i)];
buffer.push((a << 2) | (b >> 4));
c = lookup[string.charAt(++i)];
if (c == 64) {
break;
// encoder
// [https://gist.github.com/999166] by [https://github.com/nignag]
encode = Opal.global.btoa || function (input) {
var str = String(input);
/* jshint ignore:start */
for (
// initialize result and counter
var block, charCode, idx = 0, map = chars, output = '';
// if the next str index does not exist:
// change the mapping table to "="
// check if d has no fractional digits
str.charAt(idx | 0) || (map = '=', idx % 1);
// "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
output += map.charAt(63 & block >> 8 - idx % 1 * 8)
) {
charCode = str.charCodeAt(idx += 3/4);
if (charCode > 0xFF) {
self.$raise($$($nesting, 'ArgumentError'), "invalid character (failed: The string to be encoded contains characters outside of the Latin1 range.)");
}
buffer.push(((b & 15) << 4) | (c >> 2));
d = lookup[string.charAt(++i)];
if (d == 64) {
break;
}
buffer.push(((c & 3) << 6) | d);
block = block << 8 | charCode;
}
return output;
/* jshint ignore:end */
};
return buffer;
}
function decode(string) {
var buffer = from(string),
result = [], a, b, c;
for (var i = 0, length = buffer.length; i < length; i++) {
if (buffer[i] < 128) {
result.push(String.fromCharCode(buffer[i]));
}
else if (buffer[i] > 191 && buffer[i] < 224) {
a = (buffer[i] & 31) << 6;
b = buffer[++i] & 63;
result.push(String.fromCharCode(a | b));
}
else {
a = (buffer[i] & 15) << 12;
b = (buffer[++i] & 63) << 6;
c = buffer[++i] & 63;
result.push(String.fromCharCode(a | b | c));
}
// decoder
// [https://gist.github.com/1020396] by [https://github.com/atk]
decode = Opal.global.atob || function (input) {
var str = String(input).replace(/=+$/, '');
if (str.length % 4 == 1) {
self.$raise($$($nesting, 'ArgumentError'), "invalid base64 (failed: The string to be decoded is not correctly encoded.)");
}
return result.join('');
}
function to(string) {
var buffer = [], i, length;
if (/^[\x00-\x7f]*$/.test(string)) {
for (i = 0, length = string.length; i < length; i++) {
buffer.push(string.charCodeAt(i));
}
/* jshint ignore:start */
for (
// initialize result and counters
var bc = 0, bs, buffer, idx = 0, output = '';
// get next character
buffer = str.charAt(idx++);
// character found in table? initialize bit storage and add its ascii value;
~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
// and if not first of each 4 characters,
// convert the first 8 bits to one ascii character
bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
) {
// try to find character in table (0-63, not found => -1)
buffer = chars.indexOf(buffer);
}
else {
for (i = 0, length = string.length; i < length; i++) {
var ch = string.charCodeAt(i);
if (ch < 128) {
buffer.push(ch);
}
else if (ch < 2048) {
buffer.push((ch >> 6) | 192);
buffer.push((ch & 63) | 128);
}
else {
buffer.push((ch >> 12) | 224);
buffer.push(((ch >> 6) & 63) | 128);
buffer.push((ch & 63) | 128);
}
}
}
return buffer;
}
function encode(string) {
var buffer = to(string),
result = [];
for (var i = 0, length = buffer.length; i < length; i++) {
var a = buffer[i],
b = buffer[++i],
c = 0,
d = a >> 2,
e = ((a & 3) << 4) | (b >> 4),
f = 0,
g = 0;
if (isNaN(a)) {
f = g = 64;
}
else {
c = buffer[++i];
f = ((b & 15) << 2) | (c >> 6);
g = isNaN(c) ? 64 : c & 63;
}
result.push(charset.charAt(d));
result.push(charset.charAt(e));
result.push(charset.charAt(f));
result.push(charset.charAt(g));
}
return result.join('');
}
Opal.defs(self, '$decode64', function(string) {
return output;
/* jshint ignore:end */
};
;
Opal.defs(self, '$decode64', $Base64_decode64$1 = function $$decode64(string) {
var self = this;
return decode(string.replace(/\r?\n/g, ''));
});
Opal.defs(self, '$encode64', function(string) {
}, $Base64_decode64$1.$$arity = 1);
Opal.defs(self, '$encode64', $Base64_encode64$2 = function $$encode64(string) {
var self = this;
return encode(string).replace(/(.{60})/g, "$1\n");
});
Opal.defs(self, '$strict_decode64', function(string) {
return encode(string).replace(/(.{60})/g, "$1\n").replace(/([^\n])$/g, "$1\n");
}, $Base64_encode64$2.$$arity = 1);
Opal.defs(self, '$strict_decode64', $Base64_strict_decode64$3 = function $$strict_decode64(string) {
var self = this;
return decode(string);
});
Opal.defs(self, '$strict_encode64', function(string) {
}, $Base64_strict_decode64$3.$$arity = 1);
Opal.defs(self, '$strict_encode64', $Base64_strict_encode64$4 = function $$strict_encode64(string) {
var self = this;
return encode(string);
});
Opal.defs(self, '$urlsafe_decode64', function(string) {
}, $Base64_strict_encode64$4.$$arity = 1);
Opal.defs(self, '$urlsafe_decode64', $Base64_urlsafe_decode64$5 = function $$urlsafe_decode64(string) {
var self = this;
return decode(string.replace(/\-/g, '+').replace(/_/g, '/'));
});
}, $Base64_urlsafe_decode64$5.$$arity = 1);
Opal.defs(self, '$urlsafe_encode64', $Base64_urlsafe_encode64$6 = function $$urlsafe_encode64(string, $kwargs) {
var padding, self = this, str = nil;
Opal.defs(self, '$urlsafe_encode64', function(string) {
var self = this;
return encode(string).replace(/\+/g, '-').replace(/\//g, '_');
});
})($scope.base)
if ($kwargs == null) {
$kwargs = $hash2([], {});
} else if (!$kwargs.$$is_hash) {
throw Opal.ArgumentError.$new('expected kwargs');
};
padding = $kwargs.$$smap["padding"];
if (padding == null) {
padding = true
};
str = encode(string).replace(/\+/g, '-').replace(/\//g, '_');
if ($truthy(padding)) {
} else {
str = str.$delete("=")
};
return str;
}, $Base64_urlsafe_encode64$6.$$arity = -2);
})($nesting[0], $nesting)
})(Opal);

@@ -1,17 +0,41 @@

/* Generated by Opal 0.9.0.rc1 */
/* Generated by Opal 1.0.3 */
(function(Opal) {
Opal.dynamic_require_severity = "error";
var OPAL_CONFIG = { method_missing: true, arity_check: false, freezing: true, tainting: true };
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $hash2 = Opal.hash2, $klass = Opal.klass;
function $rb_minus(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
}
var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy;
Opal.add_stubs(['$new', '$push', '$[]=', '$[]', '$create_id', '$json_create', '$attr_accessor', '$create_id=', '$===', '$parse', '$generate', '$from_object', '$merge', '$to_json', '$responds_to?', '$to_io', '$write', '$to_s', '$to_a', '$strftime']);
(function($base) {
var $JSON, self = $JSON = $module($base, 'JSON');
Opal.add_stubs(['$raise', '$new', '$push', '$[]=', '$-', '$[]', '$create_id', '$json_create', '$const_get', '$attr_accessor', '$create_id=', '$===', '$parse', '$generate', '$from_object', '$merge', '$to_json', '$responds_to?', '$to_io', '$write', '$to_s', '$to_a', '$strftime']);
(function($base, $parent_nesting) {
var self = $module($base, 'JSON');
var def = self.$$proto, $scope = self.$$scope, $a, $b;
var $nesting = [self].concat($parent_nesting), $JSON_$$$1, $JSON_parse$2, $JSON_parse$excl$3, $JSON_load$4, $JSON_from_object$5, $JSON_generate$6, $JSON_dump$7, $writer = nil;
var $parse = JSON.parse,
$hasOwn = Opal.hasOwnProperty;
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'JSONError');
var $nesting = [self].concat($parent_nesting);
return nil
})($nesting[0], $$($nesting, 'StandardError'), $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'ParserError');
var $nesting = [self].concat($parent_nesting);
return nil
})($nesting[0], $$($nesting, 'JSONError'), $nesting);
var $hasOwn = Opal.hasOwnProperty;
function $parse(source) {
try {
return JSON.parse(source);
} catch (e) {
self.$raise($$$($$($nesting, 'JSON'), 'ParserError'), e.message);
}
};
function to_opal(value, options) {

@@ -50,9 +74,8 @@ var klass, arr, hash, i, ii, k;

if ($hasOwn.call(value, k)) {
(hash)['$[]='](k, to_opal(value[k], options));
(($writer = [k, to_opal(value[k], options)]), $send((hash), '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]);
}
}
if (!options.parse && (klass = (hash)['$[]']($scope.get('JSON').$create_id())) != nil) {
klass = Opal.get(klass);
return (klass).$json_create(hash);
if (!options.parse && (klass = (hash)['$[]']($$($nesting, 'JSON').$create_id())) != nil) {
return $$$('::', 'Object').$const_get(klass).$json_create(hash);
}

@@ -65,122 +88,131 @@ else {

};
;
(function(self, $parent_nesting) {
var $nesting = [self].concat($parent_nesting);
(function(self) {
var $scope = self.$$scope, def = self.$$proto;
return self.$attr_accessor("create_id")
})(Opal.get_singleton_class(self));
})(Opal.get_singleton_class(self), $nesting);
$writer = ["json_class"];
$send(self, 'create_id=', Opal.to_a($writer));
$writer[$rb_minus($writer["length"], 1)];;
Opal.defs(self, '$[]', $JSON_$$$1 = function(value, options) {
var self = this;
(($a = ["json_class"]), $b = self, $b['$create_id='].apply($b, $a), $a[$a.length-1]);
Opal.defs(self, '$[]', function(value, options) {
var $a, self = this;
if (options == null) {
options = $hash2([], {})
}
if ((($a = $scope.get('String')['$==='](value)) !== nil && (!$a.$$is_boolean || $a == true))) {
options = $hash2([], {});
};
if ($truthy($$($nesting, 'String')['$==='](value))) {
return self.$parse(value, options)
} else {
} else {
return self.$generate(value, options)
};
});
Opal.defs(self, '$parse', function(source, options) {
}, $JSON_$$$1.$$arity = -2);
Opal.defs(self, '$parse', $JSON_parse$2 = function $$parse(source, options) {
var self = this;
if (options == null) {
options = $hash2([], {})
}
options = $hash2([], {});
};
return self.$from_object($parse(source), options.$merge($hash2(["parse"], {"parse": true})));
});
Opal.defs(self, '$parse!', function(source, options) {
}, $JSON_parse$2.$$arity = -2);
Opal.defs(self, '$parse!', $JSON_parse$excl$3 = function(source, options) {
var self = this;
if (options == null) {
options = $hash2([], {})
}
options = $hash2([], {});
};
return self.$parse(source, options);
});
Opal.defs(self, '$load', function(source, options) {
}, $JSON_parse$excl$3.$$arity = -2);
Opal.defs(self, '$load', $JSON_load$4 = function $$load(source, options) {
var self = this;
if (options == null) {
options = $hash2([], {})
}
options = $hash2([], {});
};
return self.$from_object($parse(source), options);
});
}, $JSON_load$4.$$arity = -2);
Opal.defs(self, '$from_object', $JSON_from_object$5 = function $$from_object(js_object, options) {
var $a, self = this, $writer = nil;
Opal.defs(self, '$from_object', function(js_object, options) {
var $a, $b, $c, self = this;
if (options == null) {
options = $hash2([], {})
}
($a = "object_class", $b = options, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, $scope.get('Hash'))));
($a = "array_class", $b = options, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, $scope.get('Array'))));
return to_opal(js_object, options.$$smap);
});
Opal.defs(self, '$generate', function(obj, options) {
options = $hash2([], {});
};
($truthy($a = options['$[]']("object_class")) ? $a : (($writer = ["object_class", $$($nesting, 'Hash')]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
($truthy($a = options['$[]']("array_class")) ? $a : (($writer = ["array_class", $$($nesting, 'Array')]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
return to_opal(js_object, options.$$smap);;
}, $JSON_from_object$5.$$arity = -2);
Opal.defs(self, '$generate', $JSON_generate$6 = function $$generate(obj, options) {
var self = this;
if (options == null) {
options = $hash2([], {})
}
options = $hash2([], {});
};
return obj.$to_json(options);
});
}, $JSON_generate$6.$$arity = -2);
Opal.defs(self, '$dump', $JSON_dump$7 = function $$dump(obj, io, limit) {
var self = this, string = nil;
Opal.defs(self, '$dump', function(obj, io, limit) {
var $a, self = this, string = nil;
if (io == null) {
io = nil
}
io = nil;
};
if (limit == null) {
limit = nil
}
limit = nil;
};
string = self.$generate(obj);
if (io !== false && io !== nil) {
if ((($a = io['$responds_to?']("to_io")) !== nil && (!$a.$$is_boolean || $a == true))) {
if ($truthy(io)) {
if ($truthy(io['$responds_to?']("to_io"))) {
io = io.$to_io()};
io.$write(string);
return io;
} else {
} else {
return string
};
});
})($scope.base);
(function($base, $super) {
function $Object(){};
var self = $Object = $klass($base, $super, 'Object', $Object);
}, $JSON_dump$7.$$arity = -2);
})($nesting[0], $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Object');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Object_to_json$8;
return (Opal.defn(self, '$to_json', function() {
return (Opal.def(self, '$to_json', $Object_to_json$8 = function $$to_json() {
var self = this;
return self.$to_s().$to_json();
}), nil) && 'to_json'
})($scope.base, null);
(function($base) {
var $Enumerable, self = $Enumerable = $module($base, 'Enumerable');
return self.$to_s().$to_json()
}, $Object_to_json$8.$$arity = 0), nil) && 'to_json'
})($nesting[0], null, $nesting);
(function($base, $parent_nesting) {
var self = $module($base, 'Enumerable');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Enumerable_to_json$9;
Opal.defn(self, '$to_json', function() {
Opal.def(self, '$to_json', $Enumerable_to_json$9 = function $$to_json() {
var self = this;
return self.$to_a().$to_json();
})
})($scope.base);
(function($base, $super) {
function $Array(){};
var self = $Array = $klass($base, $super, 'Array', $Array);
return self.$to_a().$to_json()
}, $Enumerable_to_json$9.$$arity = 0)
})($nesting[0], $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Array');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Array_to_json$10;
return (Opal.defn(self, '$to_json', function() {
return (Opal.def(self, '$to_json', $Array_to_json$10 = function $$to_json() {
var self = this;

@@ -197,23 +229,21 @@

}), nil) && 'to_json'
})($scope.base, null);
(function($base, $super) {
function $Boolean(){};
var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean);
}, $Array_to_json$10.$$arity = 0), nil) && 'to_json'
})($nesting[0], null, $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Boolean');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Boolean_to_json$11;
return (Opal.defn(self, '$to_json', function() {
return (Opal.def(self, '$to_json', $Boolean_to_json$11 = function $$to_json() {
var self = this;
return (self == true) ? 'true' : 'false';
}), nil) && 'to_json'
})($scope.base, null);
(function($base, $super) {
function $Hash(){};
var self = $Hash = $klass($base, $super, 'Hash', $Hash);
}, $Boolean_to_json$11.$$arity = 0), nil) && 'to_json'
})($nesting[0], null, $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Hash');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Hash_to_json$12;
return (Opal.defn(self, '$to_json', function() {
return (Opal.def(self, '$to_json', $Hash_to_json$12 = function $$to_json() {
var self = this;

@@ -238,67 +268,63 @@

return '{' + result.join(', ') + '}';
;
}), nil) && 'to_json'
})($scope.base, null);
(function($base, $super) {
function $NilClass(){};
var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass);
}, $Hash_to_json$12.$$arity = 0), nil) && 'to_json'
})($nesting[0], null, $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'NilClass');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $NilClass_to_json$13;
return (Opal.defn(self, '$to_json', function() {
return (Opal.def(self, '$to_json', $NilClass_to_json$13 = function $$to_json() {
var self = this;
return "null";
}), nil) && 'to_json'
})($scope.base, null);
(function($base, $super) {
function $Numeric(){};
var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric);
return "null"
}, $NilClass_to_json$13.$$arity = 0), nil) && 'to_json'
})($nesting[0], null, $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Numeric');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Numeric_to_json$14;
return (Opal.defn(self, '$to_json', function() {
return (Opal.def(self, '$to_json', $Numeric_to_json$14 = function $$to_json() {
var self = this;
return self.toString();
}), nil) && 'to_json'
})($scope.base, null);
(function($base, $super) {
function $String(){};
var self = $String = $klass($base, $super, 'String', $String);
}, $Numeric_to_json$14.$$arity = 0), nil) && 'to_json'
})($nesting[0], null, $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'String');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting);
return Opal.alias(self, 'to_json', 'inspect')
})($scope.base, null);
(function($base, $super) {
function $Time(){};
var self = $Time = $klass($base, $super, 'Time', $Time);
return Opal.alias(self, "to_json", "inspect")
})($nesting[0], null, $nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Time');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Time_to_json$15;
return (Opal.defn(self, '$to_json', function() {
return (Opal.def(self, '$to_json', $Time_to_json$15 = function $$to_json() {
var self = this;
return self.$strftime("%FT%T%z").$to_json();
}), nil) && 'to_json'
})($scope.base, null);
return (function($base, $super) {
function $Date(){};
var self = $Date = $klass($base, $super, 'Date', $Date);
return self.$strftime("%FT%T%z").$to_json()
}, $Time_to_json$15.$$arity = 0), nil) && 'to_json'
})($nesting[0], null, $nesting);
return (function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Date');
var def = self.$$proto, $scope = self.$$scope;
var $nesting = [self].concat($parent_nesting), $Date_to_json$16, $Date_as_json$17;
Opal.defn(self, '$to_json', function() {
Opal.def(self, '$to_json', $Date_to_json$16 = function $$to_json() {
var self = this;
return self.$to_s().$to_json();
});
return (Opal.defn(self, '$as_json', function() {
return self.$to_s().$to_json()
}, $Date_to_json$16.$$arity = 0);
return (Opal.def(self, '$as_json', $Date_as_json$17 = function $$as_json() {
var self = this;
return self.$to_s();
}), nil) && 'as_json';
})($scope.base, null);
return self.$to_s()
}, $Date_as_json$17.$$arity = 0), nil) && 'as_json';
})($nesting[0], null, $nesting);
})(Opal);

@@ -1,91 +0,97 @@

/* Generated by Opal 0.9.0.rc1 */
/* Generated by Opal 1.0.3 */
(function(Opal) {
Opal.dynamic_require_severity = "error";
var OPAL_CONFIG = { method_missing: true, arity_check: false, freezing: true, tainting: true };
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2;
function $rb_minus(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
}
var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
Opal.add_stubs(['$[]', '$[]=', '$keys', '$attr_reader', '$instance_exec', '$to_proc', '$new', '$<<', '$join']);
return (function($base, $super) {
function $Template(){};
var self = $Template = $klass($base, $super, 'Template', $Template);
Opal.add_stubs(['$[]', '$[]=', '$-', '$keys', '$attr_reader', '$instance_exec', '$new', '$to_proc', '$<<', '$join']);
return (function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Template');
var def = self.$$proto, $scope = self.$$scope, TMP_1;
var $nesting = [self].concat($parent_nesting), $Template_$$$1, $Template_$$$eq$2, $Template_paths$3, $Template_initialize$4, $Template_inspect$5, $Template_render$6;
def.name = def.body = nil;
self.$$prototype.name = self.$$prototype.body = nil;
self._cache = $hash2([], {});
Opal.defs(self, '$[]', function(name) {
Opal.defs(self, '$[]', $Template_$$$1 = function(name) {
var $a, self = this;
if (self._cache == null) self._cache = nil;
return ((($a = self._cache['$[]'](name)) !== false && $a !== nil) ? $a : self._cache['$[]']("templates/" + (name)));
});
Opal.defs(self, '$[]=', function(name, instance) {
var self = this;
return ($truthy($a = self._cache['$[]'](name)) ? $a : self._cache['$[]']("" + "templates/" + (name)))
}, $Template_$$$1.$$arity = 1);
Opal.defs(self, '$[]=', $Template_$$$eq$2 = function(name, instance) {
var self = this, $writer = nil;
if (self._cache == null) self._cache = nil;
return self._cache['$[]='](name, instance);
});
Opal.defs(self, '$paths', function() {
$writer = [name, instance];
$send(self._cache, '[]=', Opal.to_a($writer));
return $writer[$rb_minus($writer["length"], 1)];
}, $Template_$$$eq$2.$$arity = 2);
Opal.defs(self, '$paths', $Template_paths$3 = function $$paths() {
var self = this;
if (self._cache == null) self._cache = nil;
return self._cache.$keys();
});
return self._cache.$keys()
}, $Template_paths$3.$$arity = 0);
self.$attr_reader("body");
Opal.def(self, '$initialize', $Template_initialize$4 = function $$initialize(name) {
var $iter = $Template_initialize$4.$$p, body = $iter || nil, $a, self = this, $writer = nil;
Opal.defn(self, '$initialize', TMP_1 = function(name) {
var $a, self = this, $iter = TMP_1.$$p, body = $iter || nil;
if ($iter) $Template_initialize$4.$$p = null;
if ($iter) $Template_initialize$4.$$p = null;;
$a = [name, body], (self.name = $a[0]), (self.body = $a[1]), $a;
$writer = [name, self];
$send($$($nesting, 'Template'), '[]=', Opal.to_a($writer));
return $writer[$rb_minus($writer["length"], 1)];;
}, $Template_initialize$4.$$arity = 1);
Opal.def(self, '$inspect', $Template_inspect$5 = function $$inspect() {
var self = this;
TMP_1.$$p = null;
$a = [name, body], self.name = $a[0], self.body = $a[1], $a;
return $scope.get('Template')['$[]='](name, self);
});
Opal.defn(self, '$inspect', function() {
return "" + "#<Template: '" + (self.name) + "'>"
}, $Template_inspect$5.$$arity = 0);
Opal.def(self, '$render', $Template_render$6 = function $$render(ctx) {
var self = this;
return "#<Template: '" + (self.name) + "'>";
});
Opal.defn(self, '$render', function(ctx) {
var $a, $b, self = this;
if (ctx == null) {
ctx = self
}
return ($a = ($b = ctx).$instance_exec, $a.$$p = self.body.$to_proc(), $a).call($b, $scope.get('OutputBuffer').$new());
});
ctx = self;
};
return $send(ctx, 'instance_exec', [$$($nesting, 'OutputBuffer').$new()], self.body.$to_proc());
}, $Template_render$6.$$arity = -1);
return (function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'OutputBuffer');
return (function($base, $super) {
function $OutputBuffer(){};
var self = $OutputBuffer = $klass($base, $super, 'OutputBuffer', $OutputBuffer);
var $nesting = [self].concat($parent_nesting), $OutputBuffer_initialize$7, $OutputBuffer_append$8, $OutputBuffer_join$9;
var def = self.$$proto, $scope = self.$$scope;
def.buffer = nil;
Opal.defn(self, '$initialize', function() {
self.$$prototype.buffer = nil;
Opal.def(self, '$initialize', $OutputBuffer_initialize$7 = function $$initialize() {
var self = this;
return self.buffer = [];
});
Opal.defn(self, '$append', function(str) {
return (self.buffer = [])
}, $OutputBuffer_initialize$7.$$arity = 0);
Opal.def(self, '$append', $OutputBuffer_append$8 = function $$append(str) {
var self = this;
return self.buffer['$<<'](str);
});
Opal.alias(self, 'append=', 'append');
return (Opal.defn(self, '$join', function() {
return self.buffer['$<<'](str)
}, $OutputBuffer_append$8.$$arity = 1);
Opal.alias(self, "append=", "append");
return (Opal.def(self, '$join', $OutputBuffer_join$9 = function $$join() {
var self = this;
return self.buffer.$join();
}), nil) && 'join';
})($scope.base, null);
})($scope.base, null)
return self.buffer.$join()
}, $OutputBuffer_join$9.$$arity = 0), nil) && 'join';
})($nesting[0], null, $nesting);
})($nesting[0], null, $nesting)
})(Opal);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc