Lines Matching refs:self

6     var self = $module($base, 'Comparable');
33 $def(self, '$==', function $Comparable_$eq_eq$1(other) {
34 var self = this, cmp = nil;
37 if ($truthy(self['$equal?'](other))) {
41 if (self["$<=>"] == Opal.Kernel["$<=>"]) {
46 if (self.$$comparable) {
47 self.$$comparable = false;
51 if (!$truthy((cmp = self['$<=>'](other)))) {
57 $def(self, '$>', function $Comparable_$gt$2(other) {
58 var self = this;
60 return cmp_or_fail(self, other) > 0;
63 $def(self, '$>=', function $Comparable_$gt_eq$3(other) {
64 var self = this;
66 return cmp_or_fail(self, other) >= 0;
69 $def(self, '$<', function $Comparable_$lt$4(other) {
70 var self = this;
72 return cmp_or_fail(self, other) < 0;
75 $def(self, '$<=', function $Comparable_$lt_eq$5(other) {
76 var self = this;
78 return cmp_or_fail(self, other) <= 0;
81 $def(self, '$between?', function $Comparable_between$ques$6(min, max) {
82 var self = this;
85 if ($rb_lt(self, min)) {
88 if ($rb_gt(self, max)) {
93 return $def(self, '$clamp', function $$clamp(min, max) {
94 var self = this;
123 c = cmp_or_fail(self, min);
125 if (c == 0) return self;
130 c = cmp_or_fail(self, max);
135 return self;
142 …not, $thrower = Opal.thrower, $alias = Opal.alias, $module = Opal.module, self = Opal.top, $nestin…
146 self.$require("corelib/comparable");
148 var self = $klass($base, $super, 'Pathname');
150 … var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype;
154 self.$include($$('Comparable'));
157 $def(self, '$initialize', function $$initialize(path) {
158 var self = this;
162 self.path = path.$path().$to_s()
164 self.path = path.$to_path()
166 self.path = path
168 self.$raise($$('TypeError'), "no implicit conversion of nil into String")
170self.$raise($$('TypeError'), "no implicit conversion of " + (path.$class()) + " into String")
172 if ($eqeq(self.path, "\u0000")) {
173 return self.$raise($$('ArgumentError'))
178 $defs(self, '$pwd', function $$pwd() {
179 var self = this;
181 return self.$new($$('Dir').$pwd())
183 self.$attr_reader("path");
185 $def(self, '$==', function $Pathname_$eq_eq$1(other) {
186 var self = this;
188 return other.$path()['$=='](self.path)
191 $def(self, '$absolute?', function $Pathname_absolute$ques$2() {
192 var self = this;
194 return self['$relative?']()['$!']()
197 $def(self, '$relative?', function $Pathname_relative$ques$3() {
198 var $a, $b, self = this, path = nil, r = nil;
201 path = self.path;
202 while ($truthy((r = self.$chop_basename(path)))) {
208 $def(self, '$chop_basename', function $$chop_basename(path) {
220 $def(self, '$root?', function $Pathname_root$ques$4() {
221 var self = this;
223 return self.path['$==']("/")
226 $def(self, '$parent', function $$parent() {
227 var self = this, new_path = nil;
230 new_path = self.path.$sub(/\/([^\/]+\/?$)/, "");
232 new_path = ($truthy(self['$absolute?']()) ? ("/") : ("."))
237 $def(self, '$sub', function $$sub($a) {
238 var $post_args, args, self = this;
243 return $$('Pathname').$new($send(self.path, 'sub', $to_a(args)));
246 $def(self, '$cleanpath', function $$cleanpath() {
247 var self = this;
249 return Opal.normalize(self.path)
252 $def(self, '$to_path', $return_ivar("path"));
254 $def(self, '$hash', $return_ivar("path"));
256 $def(self, '$expand_path', function $$expand_path() {
257 var self = this;
259 return $$('Pathname').$new($$('File').$expand_path(self.path))
262 $def(self, '$+', function $Pathname_$plus$5(other) {
263 var self = this;
269 return $$('Pathname').$new(self.$plus(self.path, other.$to_s()));
272 $def(self, '$plus', function $$plus(path1, path2) {
273 …var $a, $b, self = this, prefix2 = nil, index_list2 = nil, basename_list2 = nil, r2 = nil, basenam…
279 while ($truthy((r2 = self.$chop_basename(prefix2)))) {
296 if (!$truthy((r1 = self.$chop_basename(prefix1)))) {
311 r1 = self.$chop_basename(prefix1);
334 $def(self, '$join', function $$join($a) {try { var $t_return = $thrower('return');
335 var $post_args, args, self = this, result = nil;
341 return self
362 return $rb_plus(self, result);} catch($e) {
368 $def(self, '$split', function $$split() {
369 var self = this;
371 return [self.$dirname(), self.$basename()]
374 $def(self, '$dirname', function $$dirname() {
375 var self = this;
377 return $$('Pathname').$new($$('File').$dirname(self.path))
380 $def(self, '$basename', function $$basename() {
381 var self = this;
383 return $$('Pathname').$new($$('File').$basename(self.path))
386 $def(self, '$directory?', function $Pathname_directory$ques$7() {
387 var self = this;
389 return $$('File')['$directory?'](self.path)
392 $def(self, '$extname', function $$extname() {
393 var self = this;
395 return $$('File').$extname(self.path)
398 $def(self, '$<=>', function $Pathname_$lt_eq_gt$8(other) {
399 var self = this;
401 return self.$path()['$<=>'](other.$path())
403 …_PATHS', ($truthy($$$($$('File'), 'FNM_SYSCASE')['$nonzero?']()) ? ($send(self, 'proc', [], functi…
407 return a.$casecmp(b)['$=='](0);})) : ($send(self, 'proc', [], function $Pathname$10(a, b){
413 $def(self, '$relative_path_from', function $$relative_path_from(base_directory) {
414 …var $a, $b, self = this, dest_directory = nil, dest_prefix = nil, dest_names = nil, r = nil, basen…
417 dest_directory = self.$cleanpath().$to_s();
421 while ($truthy((r = self.$chop_basename(dest_prefix)))) {
430 while ($truthy((r = self.$chop_basename(base_prefix)))) {
438self.$raise($$('ArgumentError'), "different prefix: " + (dest_prefix.$inspect()) + " and " + (base… field
446 self.$raise($$('ArgumentError'), "base_directory has ..: " + (base_directory.$inspect())) field
457 $def(self, '$entries', function $$entries() {
458 var self = this;
460 …return $send($$('Dir').$entries(self.path), 'map', [], function $$11(f){var self = $$11.$$s == nul…
464 return self.$class().$new(f);}, {$$s: self})
466 $alias(self, "===", "==");
467 $alias(self, "eql?", "==");
468 $alias(self, "to_s", "to_path");
469 return $alias(self, "to_str", "to_path");
472 var self = $module($base, 'Kernel');
474 var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
476 return $def(self, '$Pathname', function $$Pathname(path) {