Sha256: 0cda8e866bc5fb8cb1eef610eb97b2b337d72cbc68e67b66ca41a766430e695c

Contents?: true

Size: 500 Bytes

Versions: 2

Compression:

Stored size: 500 Bytes

Contents

= Creating and Reading Annotations

Load the primary annotations library.

  require 'anise/annotation'

Given a example class X we can apply annotations to it using the #ann method. 

  class X
    include Anise::Annotation

    ann :x1, :a=>1
    ann :x1, :b=>2
  end

We can then use #ann to lookup the set annotations.

  X.ann(:x1,:a).should == 1

The #ann method is a public interface, so we can define annotation externally as well.

   X.ann :x1, :a => 2
   X.ann(:x1, :a).should == 2

QED.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
anise-0.6.0 qed/01_annotations.qed
anise-0.5.0 qed/01_annotations.qed