rubyworks / anise

Dynamic Annotations System for Ruby

Home Page:http://rubyworks.github.com/anise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Anise

Homepage / Documentation / Report Issue / Source Code

Gem Version Build Status     Flattr Me

Dynamic Annotations for Ruby

Anise is an Annotation System for the Ruby programming language. Unlike most other annotations systems it is not a comment-based or macro-based system that sits over-and-above the rest of the code. Rather, Anise is a dynamic annotations system operating at runtime.

The following example briefly demonstrates all three major features. To use any of them first require the anise library.

 require 'anise'

General annotations are provided by the Anise::Annotations module.

class X
  extend Anise::Annotations

  ann :grape, :class=>String
end

X.ann(:grape, :class)  #=> String

Annotated attributes can be easily added to a class via the Annotative::Attributes module.

class X
  extend Anise::Annotative::Attributes

  attr :baz, Integer, :max => 10
end

X.ann(:baz)  #=> {:class=>Integer, :max=>10}

Mewthod annotations can be had via the Annotative::Methods module.

class X
  extend Anise::Annotative::Methods

  def self.doc(string)
    method_annotation(:doc=>string)
  end

  doc "This is an entry."

  def bar
    # ...
  end
end

X.ann(:bar)  #=> {:doc=>"This is an entry."}

Any of these modules can be used in conjunction. Since both Annotative::Methods and Annotative::Attributes preclude Annotations all three can be used by simply using the later two.

 class X
   extend Anise::Annotative::Attributes
   extend Anise::Annotative::Methods

   ...
 end

Note also that the Anise module is clean and contains only modules and classes with detailed names starting the "Annotat-", so it is prefectly convenient for inclusion in the toplevel namespace or your own applications namespace.

module MyApp
  include Anise

  class Foo
    extend Annotative::Attributes

    ...
  end
end

Installation

RubyGems

RubyGems.org hosts the gem package. To install via RubyGems simply open a console and type:

gem install anise

Setup.rb (not recommended)

To manually install you will need Setup.rb (see http://setup.rubyforge.org). Then download the tarball package and do:

$ tar -xvzf anise-0.2.0.tgz
$ cd anise-0.2.0
$ sudo setup.rb all

Documentation

Demonstrations

Fully tested demonstrations can be seen in the DEMO document.

API Reference

The API documentation is available in YARD format via [rubydoc.info](a href="http://rubydoc.info").

Support

If you experience a problem, have a question or a feature request file a ticket with the issue tracker on GitHub.

If you would like to discuss something about this project in more detail try contacting the author(s) via the Rubyworks IRC channel or the Mailing List.

Development

Contributing

If you would like to contribute code or documentation to the Anise project, fork the upstream repository and create a branch for you changes. When your changes are ready for review (and no, they do not have to 100% perfect if you still have some issues you need help working out) then submit a pull request.

It you need to personally discuss some ideas or issues you can try to get up with us via the mailing list or the IRC channel.

Git Repository

The upstream git repository is hosted on GitHub.

Development Requirements

Anise uses the following development tools.

Test Instructions

Ainse has two test suites, one using QED and the other using Citron which is built on RubyTest.

To run the QED demonstrations simple run:

$ qed

To run the Citron-based unit tests use:

$ rubytest

Authors

Organizations

Copyrights

Copyright (c) 2008 Rubyworks. All rights reserved.

This program is distributed under the terms of the BSD-2-Clause license.

See LICNESE.txt file for details.

This project was created on 2008-02-21.

About

Dynamic Annotations System for Ruby

http://rubyworks.github.com/anise

License:Other


Languages

Language:Ruby 100.0%