123456789_123456789_123456789_123456789_123456789_

Class: Ripper::TokenPattern::MatchData

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

Class Method Summary

Instance Method Summary

Constructor Details

.new(tokens, match) ⇒ MatchData

[ GitHub ]

  
# File 'ext/ripper/lib/ripper/lexer.rb', line 352

def initialize(tokens, match)
  @tokens = tokens
  @match = match
end

Instance Method Details

#match(n = 0) (private)

[ GitHub ]

  
# File 'ext/ripper/lib/ripper/lexer.rb', line 364

def match(n = 0)
  return [] unless @match
  @tokens[@match.begin(n)...@match.end(n)].map {|pos,type,str| str }
end

#string(n = 0)

[ GitHub ]

  
# File 'ext/ripper/lib/ripper/lexer.rb', line 357

def string(n = 0)
  return nil unless @match
  match(n).join
end