summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--lib/yard/mruby/code_objects/function_object.rb9
-rw-r--r--templates/default/tags/setup.rb7
2 files changed, 16 insertions, 0 deletions
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<Array(String, String)>] 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