summaryrefslogtreecommitdiff
path: root/ext/ripper
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 07:06:24 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-08 07:06:24 +0000
commit537030e19b98cb99d161eff292a33fbdeea19a93 (patch)
tree292ab6ad968c540fca4d8034e1e99a5a9dd7bc7e /ext/ripper
parent75894547f50888b86f15c118b6e047d8b9a94a74 (diff)
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
Diffstat (limited to 'ext/ripper')
-rw-r--r--ext/ripper/lib/ripper/lexer.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index b3b78ef..5c99dfe 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -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" ],