From 5bc3b5e82c771a8238f94c8c231cfacc22b5ecb3 Mon Sep 17 00:00:00 2001 From: Seba Gamboa Date: Tue, 29 Sep 2015 14:32:23 -0300 Subject: Add function parameters to docs --- lib/yard/mruby/code_objects/function_object.rb | 9 +++++++++ templates/default/tags/setup.rb | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 templates/default/tags/setup.rb diff --git a/lib/yard/mruby/code_objects/function_object.rb b/lib/yard/mruby/code_objects/function_object.rb index 598257c..4609a21 100644 --- a/lib/yard/mruby/code_objects/function_object.rb +++ b/lib/yard/mruby/code_objects/function_object.rb @@ -31,6 +31,15 @@ module YARD::MRuby::CodeObjects @return_type = (type == 'void' ? nil : type) end + # Returns the list of parameters parsed out of the method signature + # with their default values. + # + # @return [Array] a list of parameter names followed + # by their default values (or nil) + def parameters + parameter_types.map{|t| [t.name, nil] } + end + def parameter_types @parameter_types || [] end diff --git a/templates/default/tags/setup.rb b/templates/default/tags/setup.rb new file mode 100644 index 0000000..382e6f6 --- /dev/null +++ b/templates/default/tags/setup.rb @@ -0,0 +1,7 @@ +def init + super +end + +def param + super || tag(:param) if object.type == :function +end -- cgit v1.2.3