Module | Anise::Annotative::Variables |
In: |
lib/anise/annotative/variables.rb
|
I bet you never imagined Ruby could suport `@style` annotations. Well, I am here to tell you otherwise.
The {VariableAnnotator} module allows class instance variable to be used method annotations which attach to the next defined method.
class X extend Anise::Annotative::Variables variable_annotator :@doc variable_annotator :@returns @doc = "See what I mean?" @returns = NilClass def see puts "Yes, I see!" end end X.ann(:see, :@doc) #=> "See what I mean?"
This library uses the method_added callback, so be sure to respect good practices of calling super if you need to override this method.
**IMPORTANT!!!** This library is an interesting expirement, but it remains to be determined if it makes sense for general use.
Open method annotations.
@example
variable_annotator :@doc
@param ns [Symbol]
Annotator to use. Default is `:ann`.