Sha256: fff79df1f3054ea7430f0bc2bc5b6e8bace63f92a1516d58abcbfb3f71858776
Contents?: true
Size: 605 Bytes
Versions: 2
Compression:
Stored size: 605 Bytes
Contents
= Creating and Reading Annotations Load the primary annotations library. require 'anise/annotation' Including Annotations at the toplevel should make them available to all classes. class ::Object include Anise::Annotation end Given a example class X we can apply annotations to it using the #ann method. class X 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/toplevel/01_annotations.qed |
anise-0.5.0 | qed/toplevel/01_annotations.qed |