Method: Anise::Annotative::Methods#method_annotator

Defined in:
lib/anise/annotative/methods.rb

#method_annotator(name, &block) ⇒ Object

Define a method annotation.

Examples:

method_annotator :doc

Parameters:

  • name (Symbol)

    Name of annotation.



64
65
66
67
68
69
70
71
# File 'lib/anise/annotative/methods.rb', line 64

def method_annotator(name, &block)
  (class << self; self; end).module_eval do
    define_method(name) do |*args|
      anns = { name => (args.size > 1 ? args : args.first) }
      Methods.pending_annotations[self] << [anns, block]
    end
  end
end