Lines Matching refs:self

14     var self = $module($base, 'NodeJS');
16 var $nesting = [self].concat($parent_nesting);
55 var self = $klass($base, $super, 'File');
57 var $nesting = [self].concat($parent_nesting), windows_root_rx = nil;
65 return (function(self, $parent_nesting) { argument
66 var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
70 $def(self, '$absolute_path', function $$absolute_path(path, basedir) {
124 $def(self, '$expand_path', function $$expand_path(path, basedir) {
125 …var self = this, sep = nil, sep_chars = nil, home = nil, leading_sep = nil, home_path_regexp = nil;
148 return self.$absolute_path(path, basedir);
172 $def(self, '$dirname', function $$dirname(path, level) {
173 var self = this, sep_chars = nil;
203 return self.$dirname(out, $rb_minus(level, 1))
208 $def(self, '$basename', function $$basename(name, suffix) {
240 $def(self, '$extname', function $$extname(path) {
241 var self = this, filename = nil, last_dot_idx = nil;
245 filename = self.$basename(path);
257 $def(self, '$exist?', function $exist$ques$1(path) {
262 $def(self, '$directory?', function $directory$ques$2(path) {
279 $def(self, '$join', function $$join($a) {
319 $def(self, '$split', function $$split(path) {
323 $alias(self, "realpath", "expand_path");
324 return $alias(self, "exists?", "exist?");
325 })(Opal.get_singleton_class(self), $nesting);
330 …uper = Opal.find_super, $def = Opal.def, $assign_ivar = Opal.assign_ivar, self = Opal.top, $nestin…
334 self.$require("corelib/file");
355 self.$warn(string);
443 var self = $klass($base, $super, 'File');
445 … var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype;
446 if (self.__fs__ == null) self.__fs__ = nil;
447 if (self.__path__ == null) self.__path__ = nil;
448 if (self.__util__ == null) self.__util__ = nil;
452 self.__fs__ = __fs__;
453 self.__path__ = __path__;
454 self.__util__ = __util__;
462 $defs(self, '$read', function $$read(path) {
466 $defs(self, '$write', function $$write(path, data) {
472 $defs(self, '$symlink', function $$symlink(path, new_path) {
478 $defs(self, '$delete', function $File_delete$1(path) {
482 (function(self, $parent_nesting) { argument
484 return $alias(self, "unlink", "delete")
485 })(Opal.get_singleton_class(self), $nesting);
486 $defs(self, '$exist?', function $File_exist$ques$2(path) {
494 $defs(self, '$realpath', function $$realpath(pathname, dir_string, cache) {
495 var block = $$realpath.$$p || nil, self = this;
503 pathname = self.$join(dir_string, pathname)
516 $defs(self, '$join', function $$join($a) {
526 $defs(self, '$directory?', function $File_directory$ques$3(path) {
527 var self = this, result = nil, realpath = nil;
530 if (!$truthy(self['$exist?'](path))) {
536 realpath = self.$realpath(path);
543 $defs(self, '$file?', function $File_file$ques$4(path) {
544 var self = this, result = nil, realpath = nil;
547 if (!$truthy(self['$exist?'](path))) {
553 realpath = self.$realpath(path);
560 $defs(self, '$readable?', function $File_readable$ques$5(path) {
561 var self = this;
564 if (!$truthy(self['$exist?'](path))) {
569 $defs(self, '$size', function $$size(path) {
573 $defs(self, '$open', function $$open(path, mode) {
574 var $yield = $$open.$$p || nil, self = this, file = nil;
579 file = self.$new(path, mode);
591 $defs(self, '$stat', function $$stat(path) {
599 $defs(self, '$mtime', function $$mtime(path) {
603 $defs(self, '$symlink?', function $File_symlink$ques$6(path) {
607 $defs(self, '$absolute_path', function $$absolute_path(path, basedir) {
617 $def(self, '$initialize', function $$initialize(path, flags) {
618 var $yield = $$initialize.$$p || nil, self = this, encoding_option_rx = nil, fd = nil;
623 self.binary_flag = flags['$include?']("b");
631 self.path = path;
633 …return $send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [fd,…
635 self.$attr_reader("path");
637 $def(self, '$sysread', function $$sysread(bytes) {
638 var self = this, res = nil;
640 if ($truthy(self.eof)) {
641 return self.$raise($$('EOFError'), "end of file reached")
644 if ($truthy(self.binary_flag)) {
647 var buf = executeIOAction(function(){return __fs__.readFileSync(self.path)})
658 res = executeIOAction(function(){return __fs__.readFileSync(self.path).toString('utf8')})
660 self.eof = true;
661 self.lineno = res.$size();
666 $def(self, '$write', function $$write(string) {
667 var self = this;
669 return executeIOAction(function(){return __fs__.writeSync(self.fd, string)})
672 $def(self, '$flush', function $$flush() {
673 var self = this;
675 return executeIOAction(function(){return __fs__.fsyncSync(self.fd)})
678 $def(self, '$close', function $$close() {
679 var $yield = $$close.$$p || nil, self = this;
683 executeIOAction(function(){return __fs__.closeSync(self.fd)});
684 return $send2(self, $find_super(self, 'close', $$close, false, true), 'close', [], $yield);
686 return $def(self, '$mtime', function $$mtime() {
687 var self = this;
689 return executeIOAction(function(){return __fs__.statSync(self.path).mtime})
693 var self = $klass($base, $super, 'Stat');
695 var $proto = self.$$prototype;
696 if (self.__fs__ == null) self.__fs__ = nil;
700 self.__fs__ = __fs__;
702 $def(self, '$initialize', $assign_ivar("path"));
704 $def(self, '$file?', function $Stat_file$ques$7() {
705 var self = this;
707 return executeIOAction(function(){return __fs__.statSync(self.path).isFile()})
710 $def(self, '$directory?', function $Stat_directory$ques$8() {
711 var self = this;
713 return executeIOAction(function(){return __fs__.statSync(self.path).isDirectory()})
716 $def(self, '$mtime', function $$mtime() {
717 var self = this;
719 return executeIOAction(function(){return __fs__.statSync(self.path).mtime})
722 $def(self, '$readable?', function $Stat_readable$ques$9() {
723 var self = this;
725 return executeIOAction(function(){return __fs__.accessSync(self.path, __fs__.constants.R_OK)})
728 $def(self, '$writable?', function $Stat_writable$ques$10() {
729 var self = this;
731 return executeIOAction(function(){return __fs__.accessSync(self.path, __fs__.constants.W_OK)})
733 return $def(self, '$executable?', function $Stat_executable$ques$11() {
734 var self = this;
736 return executeIOAction(function(){return __fs__.accessSync(self.path, __fs__.constants.X_OK)})
746 var self = $klass($base, $super, 'Dir');
748 var $nesting = [self].concat($parent_nesting);
749 if (self.__glob__ == null) self.__glob__ = nil;
750 if (self.__fs__ == null) self.__fs__ = nil;
751 if (self.__path__ == null) self.__path__ = nil;
752 if (self.__os__ == null) self.__os__ = nil;
755 self.__glob__ = __glob__;
756 self.__fs__ = __fs__;
757 self.__path__ = __path__;
758 self.__os__ = __os__;
759 return (function(self, $parent_nesting) { argument
760 var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
764 $def(self, '$[]', function $$$1(glob) {
769 $def(self, '$pwd', function $$pwd() {
774 $def(self, '$home', function $$home() {
779 $def(self, '$chdir', function $$chdir(path) {
784 $def(self, '$mkdir', function $$mkdir(path) {
789 $def(self, '$entries', function $$entries(dirname) {
801 $def(self, '$glob', function $$glob(pattern) {
816 return $alias(self, "getwd", "pwd");
817 })(Opal.get_singleton_class(self), $nesting);
822 …var $klass = Opal.klass, $alias = Opal.alias, $def = Opal.def, $defs = Opal.defs, self = Opal.top,…
826 self.$require("nodejs/file");
844 var self = $klass($base, $super, 'IO');
846 var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
849 self.__fs__ = __fs__;
850 self.$attr_reader("lineno");
851 $alias(self, "initialize_before_node_io", "initialize");
853 $def(self, '$initialize', function $$initialize(fd, flags) {
854 var self = this;
858 self.lineno = 0;
859 return self.$initialize_before_node_io(fd, flags);
861 $defs(self, '$write', function $$write(path, data) {
865 $defs(self, '$read', function $$read(path) {
869 return $defs(self, '$binread', function $$binread(path) {
882 (function(self, $parent_nesting) { argument
883 var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
886 self.$include($$('Enumerable'));
888 $def(self, '$inspect', $return_val("ARGF"));
890 $def(self, '$argv', function $$argv() {
895 $def(self, '$file', function $$file() {
896 var self = this, fn = nil, $ret_or_1 = nil;
897 if (self.file == null) self.file = nil;
901 fn = self.$filename();
905 …return (self.file = ($truthy(($ret_or_1 = self.file)) ? ($ret_or_1) : ($$('File').$open(fn, "r"))))
909 $def(self, '$filename', function $$filename() {
910 var self = this, $ret_or_1 = nil;
911 if (self.filename == null) self.filename = nil;
912 if (self.last_filename == null) self.last_filename = nil;
915 if ($truthy(self.filename)) {
916 return self.filename
918 if ($eqeq(self.$argv(), ["-"])) {
920 } else if ($eqeq(self.$argv(), [])) {
921 if ($truthy(($ret_or_1 = self.last_filename))) {
928 self.file = nil;
929 return (self.filename = (self.last_filename = self.$argv().$shift()));
933 $def(self, '$close', function $$close() {
934 var self = this;
937 self.$file().$close();
938 self.filename = nil;
939 return self;
942 $def(self, '$closed?', function $closed$ques$1() {
943 var self = this;
945 return self.$file()['$closed?']()
948 $def(self, '$each', function $$each($a) {
949 var block = $$each.$$p || nil, $post_args, args, self = this, l = nil;
957 return self.$enum_for("each")
959 while ($truthy((l = $send(self, 'gets', $to_a(args))))) {
964 $def(self, '$gets', function $$gets($a) {
965 var $post_args, args, self = this, s = nil;
966 if (self.lineno == null) self.lineno = nil;
971 s = $send(self.$file(), 'gets', $to_a(args));
974 self.$close();
975 s = $send(self.$file(), 'gets', $to_a(args));
978 self.lineno = $rb_plus(self.lineno, 1)
983 $def(self, '$read', function $$read(len) {
984 var self = this, buf = nil;
989 …(){try { var $t_break = $thrower('break'); return $send(self, 'loop', [], function $$2(){var self
990 if (self.filename == null) self.filename = nil;
993 r = self.$file().$read(len);
999 self.$file().$close();
1000 if ((($truthy(len) && ($truthy($rb_gt(len, 0)))) && ($truthy(self.filename)))) {
1004 };}, {$$s: self})} catch($e) {
1010 $def(self, '$readlines', function $$readlines($a) {
1011 var $post_args, args, self = this;
1016 return $send(self, 'each', $to_a(args)).$to_a();
1018 self.$attr_accessor("lineno");
1020 $def(self, '$rewind', function $$rewind() {
1021 var self = this, f = nil;
1024 self.lineno = 1;
1025 f = self.$file();
1039 $def(self, '$fileno', function $$fileno() {
1040 var self = this;
1041 if (self.last_filename == null) self.last_filename = nil;
1042 if (self.filename == null) self.filename = nil;
1045 if (($not(self.filename) && ($truthy(self.last_filename)))) {
1048 return self.$file().$fileno();
1051 $def(self, '$eof?', function $eof$ques$3() {
1052 var self = this;
1054 return self.$file()['$eof?']()
1056 $alias(self, "each_line", "each");
1057 $alias(self, "eof", "eof?");
1058 $alias(self, "path", "filename");
1059 $alias(self, "skip", "close");
1060 $alias(self, "to_i", "fileno");
1061 return $alias(self, "to_io", "file");
1070 var self = $module($base, 'OpenURI');
1072 if (self.__xmlhttprequest__ == null) self.__xmlhttprequest__ = nil;
1075 self.__xmlhttprequest__ = __xmlhttprequest__;
1076 var __XMLHttpRequest__ = self.__xmlhttprequest__.XMLHttpRequest;
1077 $defs(self, '$request', function $$request(uri) {
1087 return $defs(self, '$data', function $$data(req) {
1107 var self = $module($base, 'Comparable');
1134 $def(self, '$==', function $Comparable_$eq_eq$1(other) {
1135 var self = this, cmp = nil;
1138 if ($truthy(self['$equal?'](other))) {
1142 if (self["$<=>"] == Opal.Kernel["$<=>"]) {
1147 if (self.$$comparable) {
1148 self.$$comparable = false;
1152 if (!$truthy((cmp = self['$<=>'](other)))) {
1158 $def(self, '$>', function $Comparable_$gt$2(other) {
1159 var self = this;
1161 return cmp_or_fail(self, other) > 0;
1164 $def(self, '$>=', function $Comparable_$gt_eq$3(other) {
1165 var self = this;
1167 return cmp_or_fail(self, other) >= 0;
1170 $def(self, '$<', function $Comparable_$lt$4(other) {
1171 var self = this;
1173 return cmp_or_fail(self, other) < 0;
1176 $def(self, '$<=', function $Comparable_$lt_eq$5(other) {
1177 var self = this;
1179 return cmp_or_fail(self, other) <= 0;
1182 $def(self, '$between?', function $Comparable_between$ques$6(min, max) {
1183 var self = this;
1186 if ($rb_lt(self, min)) {
1189 if ($rb_gt(self, max)) {
1194 return $def(self, '$clamp', function $$clamp(min, max) {
1195 var self = this;
1224 c = cmp_or_fail(self, min);
1226 if (c == 0) return self;
1231 c = cmp_or_fail(self, max);
1236 return self;
1243 …not, $thrower = Opal.thrower, $alias = Opal.alias, $module = Opal.module, self = Opal.top, $nestin…
1247 self.$require("corelib/comparable");
1249 var self = $klass($base, $super, 'Pathname');
1251 … var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype;
1255 self.$include($$('Comparable'));
1258 $def(self, '$initialize', function $$initialize(path) {
1259 var self = this;
1263 self.path = path.$path().$to_s()
1265 self.path = path.$to_path()
1267 self.path = path
1269 self.$raise($$('TypeError'), "no implicit conversion of nil into String")
1271self.$raise($$('TypeError'), "no implicit conversion of " + (path.$class()) + " into String")
1273 if ($eqeq(self.path, "\u0000")) {
1274 return self.$raise($$('ArgumentError'))
1279 $defs(self, '$pwd', function $$pwd() {
1280 var self = this;
1282 return self.$new($$('Dir').$pwd())
1284 self.$attr_reader("path");
1286 $def(self, '$==', function $Pathname_$eq_eq$1(other) {
1287 var self = this;
1289 return other.$path()['$=='](self.path)
1292 $def(self, '$absolute?', function $Pathname_absolute$ques$2() {
1293 var self = this;
1295 return self['$relative?']()['$!']()
1298 $def(self, '$relative?', function $Pathname_relative$ques$3() {
1299 var $a, $b, self = this, path = nil, r = nil;
1302 path = self.path;
1303 while ($truthy((r = self.$chop_basename(path)))) {
1309 $def(self, '$chop_basename', function $$chop_basename(path) {
1321 $def(self, '$root?', function $Pathname_root$ques$4() {
1322 var self = this;
1324 return self.path['$==']("/")
1327 $def(self, '$parent', function $$parent() {
1328 var self = this, new_path = nil;
1331 new_path = self.path.$sub(/\/([^\/]+\/?$)/, "");
1333 new_path = ($truthy(self['$absolute?']()) ? ("/") : ("."))
1338 $def(self, '$sub', function $$sub($a) {
1339 var $post_args, args, self = this;
1344 return $$('Pathname').$new($send(self.path, 'sub', $to_a(args)));
1347 $def(self, '$cleanpath', function $$cleanpath() {
1348 var self = this;
1350 return Opal.normalize(self.path)
1353 $def(self, '$to_path', $return_ivar("path"));
1355 $def(self, '$hash', $return_ivar("path"));
1357 $def(self, '$expand_path', function $$expand_path() {
1358 var self = this;
1360 return $$('Pathname').$new($$('File').$expand_path(self.path))
1363 $def(self, '$+', function $Pathname_$plus$5(other) {
1364 var self = this;
1370 return $$('Pathname').$new(self.$plus(self.path, other.$to_s()));
1373 $def(self, '$plus', function $$plus(path1, path2) {
1374 …var $a, $b, self = this, prefix2 = nil, index_list2 = nil, basename_list2 = nil, r2 = nil, basenam…
1380 while ($truthy((r2 = self.$chop_basename(prefix2)))) {
1397 if (!$truthy((r1 = self.$chop_basename(prefix1)))) {
1412 r1 = self.$chop_basename(prefix1);
1435 $def(self, '$join', function $$join($a) {try { var $t_return = $thrower('return');
1436 var $post_args, args, self = this, result = nil;
1442 return self
1463 return $rb_plus(self, result);} catch($e) {
1469 $def(self, '$split', function $$split() {
1470 var self = this;
1472 return [self.$dirname(), self.$basename()]
1475 $def(self, '$dirname', function $$dirname() {
1476 var self = this;
1478 return $$('Pathname').$new($$('File').$dirname(self.path))
1481 $def(self, '$basename', function $$basename() {
1482 var self = this;
1484 return $$('Pathname').$new($$('File').$basename(self.path))
1487 $def(self, '$directory?', function $Pathname_directory$ques$7() {
1488 var self = this;
1490 return $$('File')['$directory?'](self.path)
1493 $def(self, '$extname', function $$extname() {
1494 var self = this;
1496 return $$('File').$extname(self.path)
1499 $def(self, '$<=>', function $Pathname_$lt_eq_gt$8(other) {
1500 var self = this;
1502 return self.$path()['$<=>'](other.$path())
1504 …_PATHS', ($truthy($$$($$('File'), 'FNM_SYSCASE')['$nonzero?']()) ? ($send(self, 'proc', [], functi…
1508 return a.$casecmp(b)['$=='](0);})) : ($send(self, 'proc', [], function $Pathname$10(a, b){
1514 $def(self, '$relative_path_from', function $$relative_path_from(base_directory) {
1515 …var $a, $b, self = this, dest_directory = nil, dest_prefix = nil, dest_names = nil, r = nil, basen…
1518 dest_directory = self.$cleanpath().$to_s();
1522 while ($truthy((r = self.$chop_basename(dest_prefix)))) {
1531 while ($truthy((r = self.$chop_basename(base_prefix)))) {
1539self.$raise($$('ArgumentError'), "different prefix: " + (dest_prefix.$inspect()) + " and " + (base… field
1547 self.$raise($$('ArgumentError'), "base_directory has ..: " + (base_directory.$inspect())) field
1558 $def(self, '$entries', function $$entries() {
1559 var self = this;
1561 …return $send($$('Dir').$entries(self.path), 'map', [], function $$11(f){var self = $$11.$$s == nul…
1565 return self.$class().$new(f);}, {$$s: self})
1567 $alias(self, "===", "==");
1568 $alias(self, "eql?", "==");
1569 $alias(self, "to_s", "to_path");
1570 return $alias(self, "to_str", "to_path");
1573 var self = $module($base, 'Kernel');
1575 var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
1577 return $def(self, '$Pathname', function $$Pathname(path) {
1585 …var $klass = Opal.klass, $def = Opal.def, $return_ivar = Opal.return_ivar, self = Opal.top, $nesti…
1589 self.$require("pathname");
1591 var self = $klass($base, $super, 'Pathname');
1593 … var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype;
1594 if (self.__path__ == null) self.__path__ = nil;
1598 self.$include($$('Comparable'));
1599 self.__path__ = __path__;
1601 $def(self, '$absolute?', function $Pathname_absolute$ques$1() {
1602 var self = this;
1604 return __path__.isAbsolute(self.path.$to_str())
1607 $def(self, '$relative?', function $Pathname_relative$ques$2() {
1608 var self = this;
1610 return self['$absolute?']()['$!']()
1612 return $def(self, '$to_path', $return_ivar("path"));
1622 return (function(self, $parent_nesting) { argument
1623 var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
1627 $def(self, '$[]', function $$$1(name) {
1632 $def(self, '$[]=', function $$$eq$2(name, value) {
1637 $def(self, '$key?', function $key$ques$3(name) {
1642 $def(self, '$empty?', function $empty$ques$4() {
1647 $def(self, '$keys', function $$keys() {
1652 $def(self, '$delete', function $delete$5(name) {
1661 $def(self, '$fetch', function $$fetch(key, default_value) {
1662 var block = $$fetch.$$p || nil, self = this;
1668 if ($truthy(self['$key?'](key))) {
1669 return self['$[]'](key)
1677 return self.$raise($$('KeyError'), "key not found");
1680 $def(self, '$to_s', $return_val("ENV"));
1682 $def(self, '$to_h', function $$to_h() {
1683 var self = this;
1685 …return $send(self.$keys(), 'to_h', [], function $$6(k){var self = $$6.$$s == null ? this : $$6.$$s;
1689 return [k, self['$[]'](k)];}, {$$s: self})
1692 $def(self, '$merge', function $$merge(keys) {
1693 var self = this;
1695 return self.$to_h().$merge(keys)
1697 $alias(self, "has_key?", "key?");
1698 $alias(self, "include?", "key?");
1699 $alias(self, "inspect", "to_s");
1700 $alias(self, "member?", "key?");
1701 return $alias(self, "to_hash", "to_h");
1706 var self = Opal.top, nil = Opal.nil;
1710 self.$require("nodejs/base");
1711 self.$require("nodejs/file");
1712 self.$require("nodejs/dir");
1713 self.$require("nodejs/io");
1714 self.$require("nodejs/argf");
1715 self.$require("nodejs/open-uri");
1716 self.$require("nodejs/pathname");
1717 return self.$require("nodejs/env");