Sha256: e9b2caf42bdce5d5526cde78d40dad2e0a584b391934f4e997f2097831cc1eaf

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'anise/annotation'
require 'anise/attribute'
require 'anise/annotator'

# = Anise
#
# Dynamic Annotations for Ruby.
#
#   require 'anise'
#
#   class X
#     include Anise
#
#     # Provides annotations
#     ann :foo, :class=>String
#
#     # Provides annotated attributes
#     attr :bar, Integer, :max=>10
#
#     # Provides method annotators.
#     annotator :doc
#     doc "foo is cool"
#     def foo
#       # ...
#     end
#   end
#
module Anise
  extend self 

  def included(base)
    #super(base)
    base.send(:include, Attribute)
    base.send(:include, Annotator)
    #base.extend Anise #ClassMethods
  end

  #module ClassMethods
  #  def append_features(base)
  #    super(base)
  #    Attribute.append_features(base)
  #    Annotator.append_features(base)
  #    base.extend ClassMethods
  #  end
  #end

  #
  def self.metadata
    @metadata ||= (
      require 'yaml'
      YAML.load(File.new(File.dirname(__FILE__) + '/anise.yml'))
    )
  end

  #
  def self.const_missing(name)
    metadata[name.to_s.downcase] || super(name)
  end

  VERSION = metadata['version']  # becuase Ruby 1.8~ gets in the way :(
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
anise-0.6.0 lib/anise.rb