1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Improve rdoc for Ripper, based on a patch by Oscar Del Ben [github:219]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2012-12-08 07:06:24 +00:00
parent 75894547f5
commit 537030e19b

View file

@ -13,6 +13,10 @@ require 'ripper/core'
class Ripper
# Tokenizes the Ruby program and returns an Array of String.
#
# p Ripper.tokenize("def m(a) nil end")
# # => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]
#
def Ripper.tokenize(src, filename = '-', lineno = 1)
Lexer.new(src, filename, lineno).tokenize
end
@ -23,7 +27,7 @@ class Ripper
# require 'ripper'
# require 'pp'
#
# p Ripper.lex("def m(a) nil end")
# pp Ripper.lex("def m(a) nil end")
# #=> [[[1, 0], :on_kw, "def"],
# [[1, 3], :on_sp, " " ],
# [[1, 4], :on_ident, "m" ],