module Annotatable::ClassMethods
def annotate(*attrs)
def annotate(*attrs) options = {} options = attrs.pop if attrs.last.is_a?(Hash) options.symbolize_keys! inherit = options[:inherit] if inherit @inherited_annotations ||= [] @inherited_annotations += attrs end attrs.each do |attr| class_eval %{ def self.#{attr}(string = nil) @#{attr} = string || @#{attr} end def #{attr}(string = nil) self.class.#{attr}(string) end def self.#{attr}=(string = nil) #{attr}(string) end def #{attr}=(string = nil) self.class.#{attr}=(string) end } end attrs end