Skip to content

Instantly share code, notes, and snippets.

@jemc
Created May 13, 2014 05:35
Show Gist options
  • Save jemc/898351a8d4f488a8346a to your computer and use it in GitHub Desktop.
Save jemc/898351a8d4f488a8346a to your computer and use it in GitHub Desktop.
class MyDecoratorHandler < YARD::Handlers::Ruby::Base
handles method_call(:my_decorator)
# my_decorator {meta:'data'}, def foo(a,b,c); end
def process
args = statement[1]
mdef = args[1]
metadata = args[0].source.gsub /[\r\n]/, ''
mdef.docstring = statement.docstring + ['',
"@note Decorator metadata: #{metadata}",
].join("\n")
parse_block mdef
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment