Sha256: f2f91cc335a3abff0ce8e09f960d4b48c704e30ede3b30de7ce889a44f8df19c
Contents?: true
Size: 600 Bytes
Versions: 1
Compression:
Stored size: 600 Bytes
Contents
= TOPLEVEL Annotations Extending Object with `Annotations` should make them available to all classes. class ::Object extend Anise::Annotations 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 Alternatively the `Annotations` module could be included into the `Module` class.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
anise-0.7.0 | demo/toplevel/01_annotations.md |