Sha256: bf9ec8701fbafe617212282c11c13751a874e579f27802d1e875e22120fdb06a

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

= Annotators

Load the primary annotator library.

  require 'anise/annotator'
  
Create a class that includes it.

  class X
    include Anise::Annotator

    annotator :doc

    doc "See what I mean?"
  
    def see
      puts "Yes, I see!"
    end
  end

See that it is set.
  
  X.ann(:see, :doc).assert == "See what I mean?"

Annotators can override the standard annotation procedure with a
custom procedure.

  class Y
    include Anise::Annotator

    def self.list
      @list ||= []
    end

    annotator :doc do |method, argument|
      list << [method, argument]
    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

2 entries across 2 versions & 1 rubygems

Version Path
anise-0.6.0 qed/04_annotator.rdoc
anise-0.5.0 qed/04_annotator.rdoc