summaryrefslogtreecommitdiffhomepage
path: root/lib/yard/mruby/handlers/source/method_handler.rb
diff options
context:
space:
mode:
authorSeba Gamboa <[email protected]>2015-09-23 11:42:28 -0300
committerSeba Gamboa <[email protected]>2015-09-23 11:42:37 -0300
commit731c5326b47b34364b2a8f69c6d558f52957a562 (patch)
tree213d83fe80cd4ab7922e5e0879d3bcbd01db9a8a /lib/yard/mruby/handlers/source/method_handler.rb
parenta88dcf7f44898495fd2d2535ec0c4508a4458c38 (diff)
downloadyard-mruby-731c5326b47b34364b2a8f69c6d558f52957a562.tar.gz
yard-mruby-731c5326b47b34364b2a8f69c6d558f52957a562.zip
Detecting classes and methods from C sources
Diffstat (limited to 'lib/yard/mruby/handlers/source/method_handler.rb')
-rw-r--r--lib/yard/mruby/handlers/source/method_handler.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/yard/mruby/handlers/source/method_handler.rb b/lib/yard/mruby/handlers/source/method_handler.rb
new file mode 100644
index 0000000..f3eab8c
--- /dev/null
+++ b/lib/yard/mruby/handlers/source/method_handler.rb
@@ -0,0 +1,22 @@
+module YARD::MRuby::Handlers::Source
+ class MethodHandler < Base
+ MATCH1 = /mrb_define_method\s*
+ \(
+ \s*\w+\s*,
+ \s*(\w+)\s*,
+ \s*"(\w+)"\s*,
+ \s*(\w+)\s*,
+ /mx
+
+ handles MATCH1
+ statement_class BodyStatement
+
+ process do
+ puts statement.inspect
+ statement.source.scan(MATCH1) do |var_name, name, func_name|
+ handle_method(nil, var_name, name, func_name)
+ end
+ end
+
+ end
+end