def apply_annotation(path, suffix=nil, extension="rb", plural=false)
      pn_models = Pathname.new(path)
      return unless pn_models.exist?
      suffix = "_#{suffix}" unless suffix == nil
      extension = (extension == nil) ? "" : ".#{extension}"
      @annotations.each do |model, annotation|
        prefix = (plural) ? model.name.pluralize : model.name
        pn = pn_models + "#{ActiveSupport::Inflector.underscore(prefix)}#{suffix}#{extension}"
        text = File.open(pn.to_path) { |fp| fp.read }
        re = Regexp.new("^#-(?:--)+-\n# #{model.name}.*\n(?:#.+\n)+#-(?:--)+-\n", Regexp::MULTILINE)
        if re =~ text
          text = text.sub(re, annotation)
        else
          text = "#{text}\n#{annotation}"
        end
        File.open(pn.to_path, "w") { |fp| fp.write(text) }
        puts "  Annotated #{pn.to_path}."
      end
    end
def apply_annotation(path, suffix=nil, extension="rb", plural=false)
      pn_models = Pathname.new(path)
      return unless pn_models.exist?
      suffix = "_#{suffix}" unless suffix == nil
      extension = (extension == nil) ? "" : ".#{extension}"
      @annotations.each do |model, annotation|
        prefix = (plural) ? model.name.pluralize : model.name
        pn = pn_models + "#{ActiveSupport::Inflector.underscore(prefix)}#{suffix}#{extension}"
        text = File.open(pn.to_path) { |fp| fp.read }
        re = Regexp.new("^#-(?:--)+-\n# #{model.name}.*\n(?:#.+\n)+#-(?:--)+-\n", Regexp::MULTILINE)
        if re =~ text
          text = text.sub(re, annotation)
        else
          text = "#{text}\n#{annotation}"
        end
        File.open(pn.to_path, "w") { |fp| fp.write(text) }
        puts "  Annotated #{pn.to_path}."
      end
    end
Apply annotations to a file

 @param path [String] Relative path (from root of application) of directory to apply annotations to.
 @param suffix [String] Optionally specify suffix of files to apply annotation to (e.g. "<model.name>_<suffix>.rb").
 @param extension [String] Optionally specify extension of files to apply annotaations to (e.g. "<model.name>_<suffix>.<extension>").