diff options
| author | Seba Gamboa <[email protected]> | 2015-09-24 15:27:31 -0300 |
|---|---|---|
| committer | Seba Gamboa <[email protected]> | 2015-09-24 15:27:31 -0300 |
| commit | cc49ade5e7029e4d8d8d62b7c09590042b43d65d (patch) | |
| tree | 370d836801a48940e41d756171111fd1dcbb22aa /lib/yard/mruby/handlers/header/function_handler.rb | |
| parent | 25ce0e81e111915551751dfaa23c4b53ec32afaf (diff) | |
| download | yard-mruby-cc49ade5e7029e4d8d8d62b7c09590042b43d65d.tar.gz yard-mruby-cc49ade5e7029e4d8d8d62b7c09590042b43d65d.zip | |
Registering function objects
Diffstat (limited to 'lib/yard/mruby/handlers/header/function_handler.rb')
| -rw-r--r-- | lib/yard/mruby/handlers/header/function_handler.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/yard/mruby/handlers/header/function_handler.rb b/lib/yard/mruby/handlers/header/function_handler.rb index e69de29..9b98258 100644 --- a/lib/yard/mruby/handlers/header/function_handler.rb +++ b/lib/yard/mruby/handlers/header/function_handler.rb @@ -0,0 +1,23 @@ +module YARD::MRuby::Handlers::Header + class FunctionHandler < Base + MATCH = / + MRB_(API|INLINE)\s+((\w+\s+)+)(\w+)\s*\( + /mx + + handles MATCH + statement_class ToplevelStatement + + process do + handle_function(statement) + end + + def handle_function(statement) + header = self.header(statement.file) + + statement.source.scan(MATCH) do |type, prefix, _, name, *args| + register FunctionObject.new(header, name) do |obj| + end + end + end + end +end |
