3
votes

Ok I have task where I have to extract methods and comments from ruby file and store them in db as reference

before this I manage to spin off with this piece of Code to achieve the same

module Describe
  def describe(method_name,description)
    @@method_descriptions ||= []
    @@method_descriptions << [method_name,description]
  end

  def method_descriptions
    Hash[@@method_descriptions]
  end
end

and then use something like this inside a class

   class A
      extend Describe

      def call_me
      end
      describe :call_me,"This method is you to invoke"
   end 

But the Fact that I have to write the some code to this is and also they aren't the actual comment

Can I achieve the same thing with YARD

1

1 Answers

0
votes

YARD uses an enhanced notation of RDoc, so at least you can write the documentation as comments above a method.

The raw output data from YARD can be stored in a database. At least, that is what the Feature list claims.