This commit is contained in:
2025-05-12 05:38:44 +09:00
parent dced21c3f8
commit 6d78bfa46e
8120 changed files with 1161564 additions and 0 deletions

21
book/node_modules/asciidoctor-opal-runtime/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Guillaume Grossetie
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

14
book/node_modules/asciidoctor-opal-runtime/README.md generated vendored Normal file
View File

@ -0,0 +1,14 @@
# Opal Runtime for Asciidoctor.js
:caution-caption: :fire:
[caption=Status]
CAUTION: This library is an _highly optimized_ version of the Opal runtime that contains the *bare minimum to run Asciidoctor*. If you are looking for a general purpose Opal runtime, please use https://www.npmjs.com/package/opal-runtime.
## Usage
```javascript
var Opal = require('opal-runtime').Opal;
// Now let's have fun with Opal!
```

View File

@ -0,0 +1,45 @@
{
"name": "asciidoctor-opal-runtime",
"description": "Opal Runtime for Asciidoctor.js",
"keywords": [
"javascript",
"opal",
"asciidoctor",
"runtime",
"ruby"
],
"author": "Guillaume Grossetie",
"version": "0.3.3",
"license": "MIT",
"engines": {
"node": ">=8.11"
},
"files": [
"src"
],
"directories": {
"lib": "src"
},
"main": "src/index.js",
"scripts": {
"test": "mocha spec/*.spec.js && mocha spec/load/load-compat.spec.js && mocha spec/load/load-error.spec.js",
"lint": "standard src/index.js spec npm",
"prepublishOnly": "node npm/prepublish.js",
"postpublish": "node npm/postpublish.js"
},
"homepage": "http://github.com/mogztter/asciidoctor-opal-node-runtime",
"bugs": "https://github.com/mogztter/asciidoctor-opal-node-runtime/issues",
"repository": {
"type": "git",
"url": "git://github.com/mogztter/asciidoctor-opal-node-runtime.git"
},
"dependencies": {
"glob": "7.1.3",
"unxhr": "1.0.1"
},
"devDependencies": {
"chai": "4.2.0",
"mocha": "^8.2.0",
"standard": "12.0.1"
}
}

View File

@ -0,0 +1,29 @@
/* global globalThis, self */
var globalObject
if (typeof globalThis !== 'undefined') {
globalObject = globalThis
} else if (typeof self !== 'undefined') {
globalObject = self
} else if (typeof window !== 'undefined') {
globalObject = window
} else if (typeof global !== 'undefined') {
globalObject = global
} else {
throw new Error('Unable to locate global object. Unsupported runtime.')
}
if (globalObject && globalObject.Opal) {
// Opal is already loaded!
var rubyEngineVersion = globalObject.Opal.$$['RUBY_ENGINE_VERSION']
if (!rubyEngineVersion.startsWith('0.11')) {
// incompatible version!
throw new Error('Opal is already loaded and version ' + rubyEngineVersion + ' is not compatible with 0.11. Please upgrade Asciidoctor.js to the latest version.')
}
} else {
// load Opal
require('./opal.js')
require('./nodejs.js')
require('./pathname.js')
require('./stringio.js')
}
module.exports.Opal = globalObject.Opal

1383
book/node_modules/asciidoctor-opal-runtime/src/nodejs.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

20076
book/node_modules/asciidoctor-opal-runtime/src/opal.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,513 @@
/* Generated by Opal 0.11.99.dev */
Opal.modules["corelib/comparable"] = function(Opal) {
function $rb_gt(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
}
function $rb_lt(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, $truthy = Opal.truthy;
Opal.add_stubs(['$===', '$>', '$<', '$equal?', '$<=>', '$normalize', '$raise', '$class']);
return (function($base, $parent_nesting) {
var self = $module($base, 'Comparable');
var $nesting = [self].concat($parent_nesting), $Comparable_normalize$1, $Comparable_$eq_eq$2, $Comparable_$gt$3, $Comparable_$gt_eq$4, $Comparable_$lt$5, $Comparable_$lt_eq$6, $Comparable_between$ques$7, $Comparable_clamp$8;
Opal.defs(self, '$normalize', $Comparable_normalize$1 = function $$normalize(what) {
var self = this;
if ($truthy($$($nesting, 'Integer')['$==='](what))) {
return what};
if ($truthy($rb_gt(what, 0))) {
return 1};
if ($truthy($rb_lt(what, 0))) {
return -1};
return 0;
}, $Comparable_normalize$1.$$arity = 1);
Opal.def(self, '$==', $Comparable_$eq_eq$2 = function(other) {
var self = this, cmp = nil;
try {
if ($truthy(self['$equal?'](other))) {
return true};
if (self["$<=>"] == Opal.Kernel["$<=>"]) {
return false;
}
// check for infinite recursion
if (self.$$comparable) {
delete self.$$comparable;
return false;
}
;
if ($truthy((cmp = self['$<=>'](other)))) {
} else {
return false
};
return $$($nesting, 'Comparable').$normalize(cmp) == 0;
} catch ($err) {
if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
try {
return false
} finally { Opal.pop_exception() }
} else { throw $err; }
}
}, $Comparable_$eq_eq$2.$$arity = 1);
Opal.def(self, '$>', $Comparable_$gt$3 = function(other) {
var self = this, cmp = nil;
if ($truthy((cmp = self['$<=>'](other)))) {
} else {
self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
};
return $$($nesting, 'Comparable').$normalize(cmp) > 0;
}, $Comparable_$gt$3.$$arity = 1);
Opal.def(self, '$>=', $Comparable_$gt_eq$4 = function(other) {
var self = this, cmp = nil;
if ($truthy((cmp = self['$<=>'](other)))) {
} else {
self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
};
return $$($nesting, 'Comparable').$normalize(cmp) >= 0;
}, $Comparable_$gt_eq$4.$$arity = 1);
Opal.def(self, '$<', $Comparable_$lt$5 = function(other) {
var self = this, cmp = nil;
if ($truthy((cmp = self['$<=>'](other)))) {
} else {
self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
};
return $$($nesting, 'Comparable').$normalize(cmp) < 0;
}, $Comparable_$lt$5.$$arity = 1);
Opal.def(self, '$<=', $Comparable_$lt_eq$6 = function(other) {
var self = this, cmp = nil;
if ($truthy((cmp = self['$<=>'](other)))) {
} else {
self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
};
return $$($nesting, 'Comparable').$normalize(cmp) <= 0;
}, $Comparable_$lt_eq$6.$$arity = 1);
Opal.def(self, '$between?', $Comparable_between$ques$7 = function(min, max) {
var self = this;
if ($rb_lt(self, min)) {
return false};
if ($rb_gt(self, max)) {
return false};
return true;
}, $Comparable_between$ques$7.$$arity = 2);
Opal.def(self, '$clamp', $Comparable_clamp$8 = function $$clamp(min, max) {
var self = this, cmp = nil;
cmp = min['$<=>'](max);
if ($truthy(cmp)) {
} else {
self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (min.$class()) + " with " + (max.$class()) + " failed")
};
if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(cmp), 0))) {
self.$raise($$($nesting, 'ArgumentError'), "min argument must be smaller than max argument")};
if ($truthy($rb_lt($$($nesting, 'Comparable').$normalize(self['$<=>'](min)), 0))) {
return min};
if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(self['$<=>'](max)), 0))) {
return max};
return self;
}, $Comparable_clamp$8.$$arity = 2);
})($nesting[0], $nesting)
};
/* Generated by Opal 0.11.99.dev */
Opal.modules["pathname"] = function(Opal) {
function $rb_plus(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, $truthy = Opal.truthy, $send = Opal.send, $module = Opal.module;
Opal.add_stubs(['$require', '$include', '$quote', '$===', '$to_s', '$path', '$respond_to?', '$to_path', '$is_a?', '$nil?', '$raise', '$class', '$==', '$attr_reader', '$!', '$relative?', '$chop_basename', '$basename', '$=~', '$new', '$source', '$[]', '$rindex', '$sub', '$absolute?', '$expand_path', '$plus', '$unshift', '$length', '$!=', '$empty?', '$first', '$shift', '$+', '$join', '$dirname', '$pop', '$reverse_each', '$directory?', '$extname', '$<=>', '$nonzero?', '$proc', '$casecmp', '$cleanpath', '$inspect', '$include?', '$fill', '$map', '$entries']);
self.$require("corelib/comparable");
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Pathname');
var $nesting = [self].concat($parent_nesting), $Pathname_initialize$1, $Pathname_$eq_eq$2, $Pathname_absolute$ques$3, $Pathname_relative$ques$4, $Pathname_chop_basename$5, $Pathname_root$ques$6, $Pathname_parent$7, $Pathname_sub$8, $Pathname_cleanpath$9, $Pathname_to_path$10, $Pathname_hash$11, $Pathname_expand_path$12, $Pathname_$plus$13, $Pathname_plus$14, $Pathname_join$15, $Pathname_split$17, $Pathname_dirname$18, $Pathname_basename$19, $Pathname_directory$ques$20, $Pathname_extname$21, $Pathname_$lt_eq_gt$22, $Pathname$23, $Pathname$24, $Pathname_relative_path_from$25, $Pathname_entries$26;
self.$$prototype.path = nil;
self.$include($$($nesting, 'Comparable'));
Opal.const_set($nesting[0], 'SEPARATOR_PAT', new RegExp($$($nesting, 'Regexp').$quote($$$($$($nesting, 'File'), 'SEPARATOR'))));
Opal.def(self, '$initialize', $Pathname_initialize$1 = function $$initialize(path) {
var self = this;
if ($truthy($$($nesting, 'Pathname')['$==='](path))) {
self.path = path.$path().$to_s()
} else if ($truthy(path['$respond_to?']("to_path"))) {
self.path = path.$to_path()
} else if ($truthy(path['$is_a?']($$($nesting, 'String')))) {
self.path = path
} else if ($truthy(path['$nil?']())) {
self.$raise($$($nesting, 'TypeError'), "no implicit conversion of nil into String")
} else {
self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (path.$class()) + " into String")
};
if (self.path['$==']("\u0000")) {
return self.$raise($$($nesting, 'ArgumentError'))
} else {
return nil
};
}, $Pathname_initialize$1.$$arity = 1);
self.$attr_reader("path");
Opal.def(self, '$==', $Pathname_$eq_eq$2 = function(other) {
var self = this;
return other.$path()['$=='](self.path)
}, $Pathname_$eq_eq$2.$$arity = 1);
Opal.def(self, '$absolute?', $Pathname_absolute$ques$3 = function() {
var self = this;
return self['$relative?']()['$!']()
}, $Pathname_absolute$ques$3.$$arity = 0);
Opal.def(self, '$relative?', $Pathname_relative$ques$4 = function() {
var $a, $b, $c, self = this, path = nil, r = nil;
path = self.path;
while ($truthy((r = self.$chop_basename(path)))) {
$c = r, $b = Opal.to_ary($c), (path = ($b[0] == null ? nil : $b[0])), $c
};
return path['$==']("");
}, $Pathname_relative$ques$4.$$arity = 0);
Opal.def(self, '$chop_basename', $Pathname_chop_basename$5 = function $$chop_basename(path) {
var self = this, base = nil;
base = $$($nesting, 'File').$basename(path);
if ($truthy($$($nesting, 'Regexp').$new("" + "^" + ($$$($$($nesting, 'Pathname'), 'SEPARATOR_PAT').$source()) + "?$")['$=~'](base))) {
return nil
} else {
return [path['$[]'](0, path.$rindex(base)), base]
};
}, $Pathname_chop_basename$5.$$arity = 1);
Opal.def(self, '$root?', $Pathname_root$ques$6 = function() {
var self = this;
return self.path['$==']("/")
}, $Pathname_root$ques$6.$$arity = 0);
Opal.def(self, '$parent', $Pathname_parent$7 = function $$parent() {
var self = this, new_path = nil;
new_path = self.path.$sub(/\/([^\/]+\/?$)/, "");
if (new_path['$==']("")) {
new_path = (function() {if ($truthy(self['$absolute?']())) {
return "/"
} else {
return "."
}; return nil; })()};
return $$($nesting, 'Pathname').$new(new_path);
}, $Pathname_parent$7.$$arity = 0);
Opal.def(self, '$sub', $Pathname_sub$8 = function $$sub($a) {
var $post_args, args, self = this;
$post_args = Opal.slice.call(arguments, 0, arguments.length);
args = $post_args;;
return $$($nesting, 'Pathname').$new($send(self.path, 'sub', Opal.to_a(args)));
}, $Pathname_sub$8.$$arity = -1);
Opal.def(self, '$cleanpath', $Pathname_cleanpath$9 = function $$cleanpath() {
var self = this;
return Opal.normalize(self.path)
}, $Pathname_cleanpath$9.$$arity = 0);
Opal.def(self, '$to_path', $Pathname_to_path$10 = function $$to_path() {
var self = this;
return self.path
}, $Pathname_to_path$10.$$arity = 0);
Opal.def(self, '$hash', $Pathname_hash$11 = function $$hash() {
var self = this;
return self.path
}, $Pathname_hash$11.$$arity = 0);
Opal.def(self, '$expand_path', $Pathname_expand_path$12 = function $$expand_path() {
var self = this;
return $$($nesting, 'Pathname').$new($$($nesting, 'File').$expand_path(self.path))
}, $Pathname_expand_path$12.$$arity = 0);
Opal.def(self, '$+', $Pathname_$plus$13 = function(other) {
var self = this;
if ($truthy($$($nesting, 'Pathname')['$==='](other))) {
} else {
other = $$($nesting, 'Pathname').$new(other)
};
return $$($nesting, 'Pathname').$new(self.$plus(self.path, other.$to_s()));
}, $Pathname_$plus$13.$$arity = 1);
Opal.def(self, '$plus', $Pathname_plus$14 = function $$plus(path1, path2) {
var $a, $b, $c, self = this, prefix2 = nil, index_list2 = nil, basename_list2 = nil, r2 = nil, basename2 = nil, prefix1 = nil, r1 = nil, basename1 = nil, suffix2 = nil;
prefix2 = path2;
index_list2 = [];
basename_list2 = [];
while ($truthy((r2 = self.$chop_basename(prefix2)))) {
$c = r2, $b = Opal.to_ary($c), (prefix2 = ($b[0] == null ? nil : $b[0])), (basename2 = ($b[1] == null ? nil : $b[1])), $c;
index_list2.$unshift(prefix2.$length());
basename_list2.$unshift(basename2);
};
if ($truthy(prefix2['$!='](""))) {
return path2};
prefix1 = path1;
while ($truthy(true)) {
while ($truthy(($truthy($c = basename_list2['$empty?']()['$!']()) ? basename_list2.$first()['$=='](".") : $c))) {
index_list2.$shift();
basename_list2.$shift();
};
if ($truthy((r1 = self.$chop_basename(prefix1)))) {
} else {
break;
};
$c = r1, $b = Opal.to_ary($c), (prefix1 = ($b[0] == null ? nil : $b[0])), (basename1 = ($b[1] == null ? nil : $b[1])), $c;
if (basename1['$=='](".")) {
continue;};
if ($truthy(($truthy($b = ($truthy($c = basename1['$==']("..")) ? $c : basename_list2['$empty?']())) ? $b : basename_list2.$first()['$!=']("..")))) {
prefix1 = $rb_plus(prefix1, basename1);
break;;};
index_list2.$shift();
basename_list2.$shift();
};
r1 = self.$chop_basename(prefix1);
if ($truthy(($truthy($a = r1['$!']()) ? new RegExp($$($nesting, 'SEPARATOR_PAT'))['$=~']($$($nesting, 'File').$basename(prefix1)) : $a))) {
while ($truthy(($truthy($b = basename_list2['$empty?']()['$!']()) ? basename_list2.$first()['$==']("..") : $b))) {
index_list2.$shift();
basename_list2.$shift();
}};
if ($truthy(basename_list2['$empty?']()['$!']())) {
suffix2 = path2['$[]'](Opal.Range.$new(index_list2.$first(), -1, false));
if ($truthy(r1)) {
return $$($nesting, 'File').$join(prefix1, suffix2)
} else {
return $rb_plus(prefix1, suffix2)
};
} else if ($truthy(r1)) {
return prefix1
} else {
return $$($nesting, 'File').$dirname(prefix1)
};
}, $Pathname_plus$14.$$arity = 2);
Opal.def(self, '$join', $Pathname_join$15 = function $$join($a) {try {
var $post_args, args, $$16, self = this, result = nil;
$post_args = Opal.slice.call(arguments, 0, arguments.length);
args = $post_args;;
if ($truthy(args['$empty?']())) {
return self};
result = args.$pop();
if ($truthy($$($nesting, 'Pathname')['$==='](result))) {
} else {
result = $$($nesting, 'Pathname').$new(result)
};
if ($truthy(result['$absolute?']())) {
return result};
$send(args, 'reverse_each', [], ($$16 = function(arg){var self = $$16.$$s || this;
if (arg == null) {
arg = nil;
};
if ($truthy($$($nesting, 'Pathname')['$==='](arg))) {
} else {
arg = $$($nesting, 'Pathname').$new(arg)
};
result = $rb_plus(arg, result);
if ($truthy(result['$absolute?']())) {
Opal.ret(result)
} else {
return nil
};}, $$16.$$s = self, $$16.$$arity = 1, $$16));
return $rb_plus(self, result);
} catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
}, $Pathname_join$15.$$arity = -1);
Opal.def(self, '$split', $Pathname_split$17 = function $$split() {
var self = this;
return [self.$dirname(), self.$basename()]
}, $Pathname_split$17.$$arity = 0);
Opal.def(self, '$dirname', $Pathname_dirname$18 = function $$dirname() {
var self = this;
return $$($nesting, 'Pathname').$new($$($nesting, 'File').$dirname(self.path))
}, $Pathname_dirname$18.$$arity = 0);
Opal.def(self, '$basename', $Pathname_basename$19 = function $$basename() {
var self = this;
return $$($nesting, 'Pathname').$new($$($nesting, 'File').$basename(self.path))
}, $Pathname_basename$19.$$arity = 0);
Opal.def(self, '$directory?', $Pathname_directory$ques$20 = function() {
var self = this;
return $$($nesting, 'File')['$directory?'](self.path)
}, $Pathname_directory$ques$20.$$arity = 0);
Opal.def(self, '$extname', $Pathname_extname$21 = function $$extname() {
var self = this;
return $$($nesting, 'File').$extname(self.path)
}, $Pathname_extname$21.$$arity = 0);
Opal.def(self, '$<=>', $Pathname_$lt_eq_gt$22 = function(other) {
var self = this;
return self.$path()['$<=>'](other.$path())
}, $Pathname_$lt_eq_gt$22.$$arity = 1);
Opal.alias(self, "eql?", "==");
Opal.alias(self, "===", "==");
Opal.alias(self, "to_str", "to_path");
Opal.alias(self, "to_s", "to_path");
Opal.const_set($nesting[0], 'SAME_PATHS', (function() {if ($truthy($$$($$($nesting, 'File'), 'FNM_SYSCASE')['$nonzero?']())) {
return $send(self, 'proc', [], ($Pathname$23 = function(a, b){var self = $Pathname$23.$$s || this;
if (a == null) {
a = nil;
};
if (b == null) {
b = nil;
};
return a.$casecmp(b)['$=='](0);}, $Pathname$23.$$s = self, $Pathname$23.$$arity = 2, $Pathname$23))
} else {
return $send(self, 'proc', [], ($Pathname$24 = function(a, b){var self = $Pathname$24.$$s || this;
if (a == null) {
a = nil;
};
if (b == null) {
b = nil;
};
return a['$=='](b);}, $Pathname$24.$$s = self, $Pathname$24.$$arity = 2, $Pathname$24))
}; return nil; })());
Opal.def(self, '$relative_path_from', $Pathname_relative_path_from$25 = function $$relative_path_from(base_directory) {
var $a, $b, $c, self = this, dest_directory = nil, dest_prefix = nil, dest_names = nil, r = nil, basename = nil, base_prefix = nil, base_names = nil, relpath_names = nil;
dest_directory = self.$cleanpath().$to_s();
base_directory = base_directory.$cleanpath().$to_s();
dest_prefix = dest_directory;
dest_names = [];
while ($truthy((r = self.$chop_basename(dest_prefix)))) {
$c = r, $b = Opal.to_ary($c), (dest_prefix = ($b[0] == null ? nil : $b[0])), (basename = ($b[1] == null ? nil : $b[1])), $c;
if ($truthy(basename['$!=']("."))) {
dest_names.$unshift(basename)};
};
base_prefix = base_directory;
base_names = [];
while ($truthy((r = self.$chop_basename(base_prefix)))) {
$c = r, $b = Opal.to_ary($c), (base_prefix = ($b[0] == null ? nil : $b[0])), (basename = ($b[1] == null ? nil : $b[1])), $c;
if ($truthy(basename['$!=']("."))) {
base_names.$unshift(basename)};
};
if ($truthy($$($nesting, 'SAME_PATHS')['$[]'](dest_prefix, base_prefix))) {
} else {
self.$raise($$($nesting, 'ArgumentError'), "" + "different prefix: " + (dest_prefix.$inspect()) + " and " + (base_directory.$inspect()))
};
while ($truthy(($truthy($b = ($truthy($c = dest_names['$empty?']()['$!']()) ? base_names['$empty?']()['$!']() : $c)) ? $$($nesting, 'SAME_PATHS')['$[]'](dest_names.$first(), base_names.$first()) : $b))) {
dest_names.$shift();
base_names.$shift();
};
if ($truthy(base_names['$include?'](".."))) {
self.$raise($$($nesting, 'ArgumentError'), "" + "base_directory has ..: " + (base_directory.$inspect()))};
base_names.$fill("..");
relpath_names = $rb_plus(base_names, dest_names);
if ($truthy(relpath_names['$empty?']())) {
return $$($nesting, 'Pathname').$new(".")
} else {
return $$($nesting, 'Pathname').$new($send($$($nesting, 'File'), 'join', Opal.to_a(relpath_names)))
};
}, $Pathname_relative_path_from$25.$$arity = 1);
return (Opal.def(self, '$entries', $Pathname_entries$26 = function $$entries() {
var $$27, self = this;
return $send($$($nesting, 'Dir').$entries(self.path), 'map', [], ($$27 = function(f){var self = $$27.$$s || this;
if (f == null) {
f = nil;
};
return self.$class().$new(f);}, $$27.$$s = self, $$27.$$arity = 1, $$27))
}, $Pathname_entries$26.$$arity = 0), nil) && 'entries';
})($nesting[0], null, $nesting);
return (function($base, $parent_nesting) {
var self = $module($base, 'Kernel');
var $nesting = [self].concat($parent_nesting), $Kernel_Pathname$28;
Opal.def(self, '$Pathname', $Kernel_Pathname$28 = function $$Pathname(path) {
var self = this;
return $$($nesting, 'Pathname').$new(path)
}, $Kernel_Pathname$28.$$arity = 1)
})($nesting[0], $nesting);
};

View File

@ -0,0 +1,328 @@
/* Generated by Opal 0.11.99.dev */
Opal.modules["stringio"] = function(Opal) {
function $rb_ge(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs);
}
function $rb_gt(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
}
function $rb_plus(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
}
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, $truthy = Opal.truthy, $gvars = Opal.gvars;
Opal.add_stubs(['$include', '$new', '$call', '$close', '$attr_accessor', '$length', '$include?', '$!', '$check_readable', '$==', '$===', '$>=', '$raise', '$>', '$+', '$-', '$seek', '$enum_for', '$eof?', '$ord', '$[]', '$to_str', '$chomp', '$check_writable', '$String', '$write', '$closed_write?', '$closed_read?']);
return (function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'StringIO');
var $nesting = [self].concat($parent_nesting), $StringIO_open$1, $StringIO_initialize$2, $StringIO_eof$ques$3, $StringIO_seek$4, $StringIO_tell$5, $StringIO_rewind$6, $StringIO_each_byte$7, $StringIO_each_char$8, $StringIO_each$9, $StringIO_write$10, $StringIO_read$11, $StringIO_close$12, $StringIO_close_read$13, $StringIO_close_write$14, $StringIO_closed$ques$15, $StringIO_closed_read$ques$16, $StringIO_closed_write$ques$17, $StringIO_check_writable$18, $StringIO_check_readable$19;
self.$$prototype.position = self.$$prototype.string = self.$$prototype.closed = nil;
self.$include($$$($$($nesting, 'IO'), 'Readable'));
self.$include($$$($$($nesting, 'IO'), 'Writable'));
Opal.defs(self, '$open', $StringIO_open$1 = function $$open(string, mode) {
var $iter = $StringIO_open$1.$$p, block = $iter || nil, self = this, io = nil, res = nil;
if ($iter) $StringIO_open$1.$$p = null;
if ($iter) $StringIO_open$1.$$p = null;;
if (string == null) {
string = "";
};
if (mode == null) {
mode = nil;
};
io = self.$new(string, mode);
res = block.$call(io);
io.$close();
return res;
}, $StringIO_open$1.$$arity = -1);
self.$attr_accessor("string");
Opal.def(self, '$initialize', $StringIO_initialize$2 = function $$initialize(string, mode) {
var $a, self = this;
if (string == null) {
string = "";
};
if (mode == null) {
mode = "rw";
};
self.string = string;
self.position = string.$length();
if ($truthy(($truthy($a = mode['$include?']("r")) ? mode['$include?']("w")['$!']() : $a))) {
return (self.closed = "write")
} else if ($truthy(($truthy($a = mode['$include?']("w")) ? mode['$include?']("r")['$!']() : $a))) {
return (self.closed = "read")
} else {
return nil
};
}, $StringIO_initialize$2.$$arity = -1);
Opal.def(self, '$eof?', $StringIO_eof$ques$3 = function() {
var self = this;
self.$check_readable();
return self.position['$=='](self.string.$length());
}, $StringIO_eof$ques$3.$$arity = 0);
Opal.alias(self, "eof", "eof?");
Opal.def(self, '$seek', $StringIO_seek$4 = function $$seek(pos, whence) {
var self = this, $case = nil;
if (whence == null) {
whence = $$$($$($nesting, 'IO'), 'SEEK_SET');
};
$case = whence;
if ($$$($$($nesting, 'IO'), 'SEEK_SET')['$===']($case)) {
if ($truthy($rb_ge(pos, 0))) {
} else {
self.$raise($$$($$($nesting, 'Errno'), 'EINVAL'))
};
self.position = pos;}
else if ($$$($$($nesting, 'IO'), 'SEEK_CUR')['$===']($case)) {if ($truthy($rb_gt($rb_plus(self.position, pos), self.string.$length()))) {
self.position = self.string.$length()
} else {
self.position = $rb_plus(self.position, pos)
}}
else if ($$$($$($nesting, 'IO'), 'SEEK_END')['$===']($case)) {if ($truthy($rb_gt(pos, self.string.$length()))) {
self.position = 0
} else {
self.position = $rb_minus(self.position, pos)
}};
return 0;
}, $StringIO_seek$4.$$arity = -2);
Opal.def(self, '$tell', $StringIO_tell$5 = function $$tell() {
var self = this;
return self.position
}, $StringIO_tell$5.$$arity = 0);
Opal.alias(self, "pos", "tell");
Opal.alias(self, "pos=", "seek");
Opal.def(self, '$rewind', $StringIO_rewind$6 = function $$rewind() {
var self = this;
return self.$seek(0)
}, $StringIO_rewind$6.$$arity = 0);
Opal.def(self, '$each_byte', $StringIO_each_byte$7 = function $$each_byte() {
var $iter = $StringIO_each_byte$7.$$p, block = $iter || nil, $a, self = this, i = nil;
if ($iter) $StringIO_each_byte$7.$$p = null;
if ($iter) $StringIO_each_byte$7.$$p = null;;
if ($truthy(block)) {
} else {
return self.$enum_for("each_byte")
};
self.$check_readable();
i = self.position;
while (!($truthy(self['$eof?']()))) {
block.$call(self.string['$[]'](i).$ord());
i = $rb_plus(i, 1);
};
return self;
}, $StringIO_each_byte$7.$$arity = 0);
Opal.def(self, '$each_char', $StringIO_each_char$8 = function $$each_char() {
var $iter = $StringIO_each_char$8.$$p, block = $iter || nil, $a, self = this, i = nil;
if ($iter) $StringIO_each_char$8.$$p = null;
if ($iter) $StringIO_each_char$8.$$p = null;;
if ($truthy(block)) {
} else {
return self.$enum_for("each_char")
};
self.$check_readable();
i = self.position;
while (!($truthy(self['$eof?']()))) {
block.$call(self.string['$[]'](i));
i = $rb_plus(i, 1);
};
return self;
}, $StringIO_each_char$8.$$arity = 0);
Opal.def(self, '$each', $StringIO_each$9 = function $$each(separator) {
var $iter = $StringIO_each$9.$$p, $yield = $iter || nil, self = this, chomp_lines = nil;
if ($gvars["/"] == null) $gvars["/"] = nil;
if ($iter) $StringIO_each$9.$$p = null;
if (separator == null) {
separator = $gvars["/"];
};
if (($yield !== nil)) {
} else {
return self.$enum_for("each_line")
};
self.$check_readable();
chomp_lines = false;
if ($truthy($$$('::', 'Hash')['$==='](separator))) {
separator = (function() {if ($truthy((chomp_lines = separator['$[]']("chomp")))) {
return /\r?\n/
} else {
return $gvars["/"]
}; return nil; })()
} else if ($truthy(separator)) {
separator = separator.$to_str()
} else {
separator = undefined
};
var str = self.string, stringLength = str.length;
if (self.position < stringLength) str = str.substr(self.position);
if (separator) {
var chomped = (str).$chomp(), trailing = str.length !== chomped.length, splitted = chomped.split(separator);
for (var i = 0, len = splitted.length; i < len; i++) {
var line = chomp_lines ? splitted[i] : (i < len - 1 || trailing ? splitted[i] + separator : splitted[i]);
Opal.yield1($yield, line);
}
} else if (separator === undefined) {
Opal.yield1($yield, str);
} else {
var m, re = /(.+(?:\n\n|$))\n*/g;
while ((m = re.exec(str))) Opal.yield1($yield, m[1]);
}
self.position = stringLength;
;
return self;
}, $StringIO_each$9.$$arity = -1);
Opal.alias(self, "each_line", "each");
Opal.def(self, '$write', $StringIO_write$10 = function $$write(string) {
var self = this, before = nil, after = nil;
self.$check_writable();
string = self.$String(string);
if (self.string.$length()['$=='](self.position)) {
self.string = $rb_plus(self.string, string);
return (self.position = $rb_plus(self.position, string.$length()));
} else {
before = self.string['$[]'](Opal.Range.$new(0, $rb_minus(self.position, 1), false));
after = self.string['$[]'](Opal.Range.$new($rb_plus(self.position, string.$length()), -1, false));
self.string = $rb_plus($rb_plus(before, string), after);
return (self.position = $rb_plus(self.position, string.$length()));
};
}, $StringIO_write$10.$$arity = 1);
Opal.def(self, '$read', $StringIO_read$11 = function $$read(length, outbuf) {
var self = this, string = nil, str = nil;
if (length == null) {
length = nil;
};
if (outbuf == null) {
outbuf = nil;
};
self.$check_readable();
if ($truthy(self['$eof?']())) {
return nil};
string = (function() {if ($truthy(length)) {
str = self.string['$[]'](self.position, length);
self.position = $rb_plus(self.position, length);
return str;
} else {
str = self.string['$[]'](Opal.Range.$new(self.position, -1, false));
self.position = self.string.$length();
return str;
}; return nil; })();
if ($truthy(outbuf)) {
return outbuf.$write(string)
} else {
return string
};
}, $StringIO_read$11.$$arity = -1);
Opal.def(self, '$close', $StringIO_close$12 = function $$close() {
var self = this;
return (self.closed = "both")
}, $StringIO_close$12.$$arity = 0);
Opal.def(self, '$close_read', $StringIO_close_read$13 = function $$close_read() {
var self = this;
if (self.closed['$==']("write")) {
return (self.closed = "both")
} else {
return (self.closed = "read")
}
}, $StringIO_close_read$13.$$arity = 0);
Opal.def(self, '$close_write', $StringIO_close_write$14 = function $$close_write() {
var self = this;
if (self.closed['$==']("read")) {
return (self.closed = "both")
} else {
return (self.closed = "write")
}
}, $StringIO_close_write$14.$$arity = 0);
Opal.def(self, '$closed?', $StringIO_closed$ques$15 = function() {
var self = this;
return self.closed['$==']("both")
}, $StringIO_closed$ques$15.$$arity = 0);
Opal.def(self, '$closed_read?', $StringIO_closed_read$ques$16 = function() {
var $a, self = this;
return ($truthy($a = self.closed['$==']("read")) ? $a : self.closed['$==']("both"))
}, $StringIO_closed_read$ques$16.$$arity = 0);
Opal.def(self, '$closed_write?', $StringIO_closed_write$ques$17 = function() {
var $a, self = this;
return ($truthy($a = self.closed['$==']("write")) ? $a : self.closed['$==']("both"))
}, $StringIO_closed_write$ques$17.$$arity = 0);
Opal.def(self, '$check_writable', $StringIO_check_writable$18 = function $$check_writable() {
var self = this;
if ($truthy(self['$closed_write?']())) {
return self.$raise($$($nesting, 'IOError'), "not opened for writing")
} else {
return nil
}
}, $StringIO_check_writable$18.$$arity = 0);
return (Opal.def(self, '$check_readable', $StringIO_check_readable$19 = function $$check_readable() {
var self = this;
if ($truthy(self['$closed_read?']())) {
return self.$raise($$($nesting, 'IOError'), "not opened for reading")
} else {
return nil
}
}, $StringIO_check_readable$19.$$arity = 0), nil) && 'check_readable';
})($nesting[0], $$($nesting, 'IO'), $nesting)
};