Class: MatchData
Overview
Opal: does not have File::Stat class File < IO # :nodoc: class Stat # :nodoc: def pretty_print(q) # :nodoc: require 'etc.so' q.object_group(self) { q.breakable q.text sprintf("dev=0x%x", self.dev); q.comma_breakable q.text "ino="; q.pp self.ino; q.comma_breakable q.group { m = self.mode q.text sprintf("mode=0%o", m) q.breakable q.text sprintf("(%s %c%c%c%c%c%c%c%c%c)", self.ftype, (m & 0400 == 0 ? ?- : ?r), (m & 0200 == 0 ? ?- : ?w), (m & 0100 == 0 ? (m & 04000 == 0 ? ?- : ?S) : (m & 04000 == 0 ? ?x : ?s)), (m & 0040 == 0 ? ?- : ?r), (m & 0020 == 0 ? ?- : ?w), (m & 0010 == 0 ? (m & 02000 == 0 ? ?- : ?S) : (m & 02000 == 0 ? ?x : ?s)), (m & 0004 == 0 ? ?- : ?r), (m & 0002 == 0 ? ?- : ?w), (m & 0001 == 0 ? (m & 01000 == 0 ? ?- : ?T) : (m & 01000 == 0 ? ?x : ?t))) } q.comma_breakable q.text "nlink="; q.pp self.nlink; q.comma_breakable q.group { q.text "uid="; q.pp self.uid begin pw = Etc.getpwuid(self.uid) rescue ArgumentError end if pw q.breakable; q.text "(#pwpw.name)" end } q.comma_breakable q.group { q.text "gid="; q.pp self.gid begin gr = Etc.getgrgid(self.gid) rescue ArgumentError end if gr q.breakable; q.text "(#grgr.name)" end } q.comma_breakable q.group { q.text sprintf("rdev=0x%x", self.rdev) if self.rdev_major && self.rdev_minor q.breakable q.text sprintf('(%d, %d)', self.rdev_major, self.rdev_minor) end } q.comma_breakable q.text "size="; q.pp self.size; q.comma_breakable q.text "blksize="; q.pp self.blksize; q.comma_breakable q.text "blocks="; q.pp self.blocks; q.comma_breakable q.group { t = self.atime q.text "atime="; q.pp t q.breakable; q.text "(#tt.tv_sec)" } q.comma_breakable q.group { t = self.mtime q.text "mtime="; q.pp t q.breakable; q.text "(#tt.tv_sec)" } q.comma_breakable q.group { t = self.ctime q.text "ctime="; q.pp t q.breakable; q.text "(#tt.tv_sec)" } } end end end
Instance Method Summary collapse
-
#pretty_print(q) ⇒ Object
:nodoc:.
-
#to_n ⇒ Object
The array of matches.
Instance Method Details
#pretty_print(q) ⇒ Object
:nodoc:
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
# File 'opal/stdlib/pp.rb', line 516 def pretty_print(q) # :nodoc: nc = [] self.regexp.named_captures.each {|name, indexes| indexes.each {|i| nc[i] = name } } q.object_group(self) { q.breakable q.seplist(0...self.size, lambda { q.breakable }) {|i| if i == 0 q.pp self[i] else if nc[i] q.text nc[i] else q.pp i end q.text ':' q.pp self[i] end } } end |
#to_n ⇒ Object
Returns the array of matches.
477 478 479 |
# File 'opal/stdlib/native.rb', line 477 def to_n @matches end |