aboutsummaryrefslogtreecommitdiffstats
path: root/ast.c
diff options
context:
space:
mode:
authoryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-11 12:15:15 +0000
committeryui-knk <yui-knk@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-11 12:15:15 +0000
commit66f239c5373aac631da87ae50f24b050d3e7d2fe (patch)
treea57e3f38e067292243c6180ffab1677df662a392 /ast.c
parent9f41da42eb146c6a2d4cd78063d11b4c2fda420e (diff)
downloadruby-66f239c5373aac631da87ae50f24b050d3e7d2fe.tar.gz
Add docs to RubyVM::AbstractSyntaxTree.of
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 33e7ba4c8c..afed691a7d 100644
--- a/ast.c
+++ b/ast.c
@@ -200,6 +200,23 @@ script_lines(VALUE path)
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)
{