Giter Club home page Giter Club logo

anise's Introduction

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.

anise's People

Contributors

trans avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

lholden awesome

anise's Issues

Special :default annotation

Often requested is the ability to designate default values for attributes. Eg.

attr :list, :default=>[]

Presently that requires a somewhat complex annotation hook. Perhaps it would be a good idea to provide direct support for :default as a special annotation.

Annotator extended

Add an option to annotator to allow the new annotation method created to accept additional annotations. For example, where as we can currently do:

annotator :doc
doc "This is a doc annotation"

It might be useful at times to do:

annotator :doc, :ext => true
doc "This is a doc annotation", :tag => 'important'

Such that :tag is an additional annotation --in much the same way as it works with #attr.

ClassMethods

I do not care much for the use of ClassMethods modules. Though I suppose it's it is for the best, is there not a more concise name we can use? Perhaps DSL or Aid? Or maybe they can be outside of the scope the module they go with. e.g. Annotation & MetaAnnotation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.