Sha256: 623328f0fa34b75ab6533dca038a71c6688d600727c85e1fd7e801affb895f8d
Contents?: true
Size: 943 Bytes
Versions: 1
Compression:
Stored size: 943 Bytes
Contents
# Method Annotations Create a class that uses the `Annotative::Methods` mixin. class X extend Anise::Annotative::Methods def self.doc(string) method_annotation(:doc=>string.to_s) end doc "See what I mean?" def see puts "Yes, I see!" end end See that it is set. X.ann(:see, :doc) #=> "See what I mean?" Method Annotators can override the standard annotation procedure with a custom procedure. In such case no annotations will actually be created unless the `#ann` is called in the procedure. class Y extend Anise::Annotative::Methods def self.list @list ||= [] end def self.doc(string) method_annotation do |method| list << [method, string] end end doc "See here!" def see puts "Yes, I see!" end end See that it is set. Y.list #=> [[:see, "See here!"]]
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
anise-0.7.0 | demo/04_methods.md |