123456789_123456789_123456789_123456789_123456789_

Class: MatchData

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/pp.rb

Instance Method Summary

Instance Method Details

#pretty_print(q)

[ GitHub ]

  
# File 'lib/pp.rb', line 529

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