[前][次][番号順一覧][スレッド一覧]

ruby-changes:53450

From: yui-knk <ko1@a...>
Date: Sun, 11 Nov 2018 21:15:21 +0900 (JST)
Subject: [ruby-changes:53450] yui-knk:r65666 (trunk): Add docs to RubyVM::AbstractSyntaxTree.of

yui-knk	2018-11-11 21:15:15 +0900 (Sun, 11 Nov 2018)

  New Revision: 65666

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65666

  Log:
    Add docs to RubyVM::AbstractSyntaxTree.of

  Modified files:
    trunk/ast.c
Index: ast.c
===================================================================
--- ast.c	(revision 65665)
+++ ast.c	(revision 65666)
@@ -200,6 +200,23 @@ script_lines(VALUE path) https://github.com/ruby/ruby/blob/trunk/ast.c#L200
     return lines;
 }
 
+/*
+ *  call-seq:
+ *     RubyVM::AbstractSyntaxTree.of(proc)   -> RubyVM::AbstractSyntaxTree::Node
+ *     RubyVM::AbstractSyntaxTree.of(method) -> RubyVM::AbstractSyntaxTree::Node
+ *
+ *   Returns AST nodes of the given proc or method.
+ *
+ *     RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
+ *     # => #<RubyVM::AbstractSyntaxTree::Node(NODE_SCOPE(0) 1:35, 1:42): >
+ *
+ *     def hello
+ *       puts "hello, world"
+ *     end
+ *
+ *     RubyVM::AbstractSyntaxTree.of(method(:hello))
+ *     # => #<RubyVM::AbstractSyntaxTree::Node(NODE_SCOPE(0) 1:0, 3:3): >
+ */
 static VALUE
 rb_ast_s_of(VALUE module, VALUE body)
 {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]