diff options
| author | Seba Gamboa <[email protected]> | 2015-09-25 13:12:22 -0300 |
|---|---|---|
| committer | Seba Gamboa <[email protected]> | 2015-09-25 13:12:22 -0300 |
| commit | 48fb10fef522ab9262061bc612b44d74a8bda17d (patch) | |
| tree | c48dcb77245e4a6b15af4366e96c31d6eb1cdd93 /lib | |
| parent | e0e43a79d282d69f2f45d5cf71e0e1154357d181 (diff) | |
| download | yard-mruby-48fb10fef522ab9262061bc612b44d74a8bda17d.tar.gz yard-mruby-48fb10fef522ab9262061bc612b44d74a8bda17d.zip | |
Listing functions
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/yard/mruby/code_objects/function_object.rb | 27 | ||||
| -rw-r--r-- | lib/yard/mruby/code_objects/header_object.rb | 4 | ||||
| -rw-r--r-- | lib/yard/mruby/code_objects/headers_root.rb | 5 | ||||
| -rw-r--r-- | lib/yard/mruby/templates.rb | 2 | ||||
| -rw-r--r-- | lib/yard/mruby/templates/helpers.rb | 1 | ||||
| -rw-r--r-- | lib/yard/mruby/templates/helpers/html_helper.rb | 20 |
6 files changed, 58 insertions, 1 deletions
diff --git a/lib/yard/mruby/code_objects/function_object.rb b/lib/yard/mruby/code_objects/function_object.rb index 0a835b5..c726762 100644 --- a/lib/yard/mruby/code_objects/function_object.rb +++ b/lib/yard/mruby/code_objects/function_object.rb @@ -2,6 +2,14 @@ module YARD::MRuby::CodeObjects # A FunctionObject represents a MRuby C API function declaration inside a header inside an include directory class FunctionObject < YARD::CodeObjects::Base + + # 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) + attr_accessor :parameters + def initialize(header, name, &block) super end @@ -14,6 +22,25 @@ module YARD::MRuby::CodeObjects def path self.name end + + def attr_info + nil + end + + def scope + '' + end + + # Returns all alias names of the object + # @return [Array<Symbol>] the alias names + def aliases + list = [] + return list unless namespace.is_a?(HeaderObject) + namespace.aliases.each do |o, aname| + list << o if aname == name && o.scope == scope + end + list + end end end diff --git a/lib/yard/mruby/code_objects/header_object.rb b/lib/yard/mruby/code_objects/header_object.rb index 519d76c..2e70230 100644 --- a/lib/yard/mruby/code_objects/header_object.rb +++ b/lib/yard/mruby/code_objects/header_object.rb @@ -14,5 +14,9 @@ module YARD::MRuby::CodeObjects def title super.to_s end + + def inheritance_tree(*args) + return [self] + end end end diff --git a/lib/yard/mruby/code_objects/headers_root.rb b/lib/yard/mruby/code_objects/headers_root.rb index 45806ff..6522c9a 100644 --- a/lib/yard/mruby/code_objects/headers_root.rb +++ b/lib/yard/mruby/code_objects/headers_root.rb @@ -4,8 +4,11 @@ module YARD::MRuby::CodeObjects def headers children end + + def inheritance_tree(*args) + return [self] + end end HEADERS_ROOT = HeadersRoot.new(:root, "headers") - end diff --git a/lib/yard/mruby/templates.rb b/lib/yard/mruby/templates.rb index 43ffd99..3010ee8 100644 --- a/lib/yard/mruby/templates.rb +++ b/lib/yard/mruby/templates.rb @@ -1,3 +1,5 @@ +require_relative 'templates/helpers' + YARD::MRuby::TEMPLATES_PATH = File.expand_path('../../../../templates', __FILE__) # This registered template works for yardoc diff --git a/lib/yard/mruby/templates/helpers.rb b/lib/yard/mruby/templates/helpers.rb new file mode 100644 index 0000000..c1fe8bb --- /dev/null +++ b/lib/yard/mruby/templates/helpers.rb @@ -0,0 +1 @@ +require_relative 'helpers/html_helper' diff --git a/lib/yard/mruby/templates/helpers/html_helper.rb b/lib/yard/mruby/templates/helpers/html_helper.rb new file mode 100644 index 0000000..46b8664 --- /dev/null +++ b/lib/yard/mruby/templates/helpers/html_helper.rb @@ -0,0 +1,20 @@ +module YARD::MRuby::Templates + module Helpers + # Helper methods for text template formats. + module HTMLHelper + + def fsignature(func, link = true, show_extras = true) + name = func.name + title = "<strong>%s</strong>" % [h(name)] + + if link + url = url_for(func) + link_url(url, title, :title => title) + else + title + end + end + + end + end +end |
