Sha256: 9e85ed4922779a6a29ec8227747a6e7ce6dbd261a36e7c7ff44b374259bb6d54

Contents?: true

Size: 760 Bytes

Versions: 7

Compression:

Stored size: 760 Bytes

Contents

module CabbageDoc
  module Generators
    class Api < Generator
      priority :high
      tags true

      def perform
        collection.clear!(tag)

        if controllers.is_a?(Hash)
          parse_with_tag!
        else
          parse_without_tag!
        end

        collection.save!
      end

      private

      def parse_with_tag!
        controllers.each do |tag, filenames|
          next if self.tag && self.tag != tag
          next unless filenames.respond_to?(:call)

          filenames.call.each do |filename|
            collection.parse!(filename, tag)
          end
        end
      end

      def parse_without_tag!
        controllers.each do |filename|
          collection.parse!(filename)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cabbage_doc-0.1.4 lib/cabbage_doc/generators/api.rb
cabbage_doc-0.1.3 lib/cabbage_doc/generators/api.rb
cabbage_doc-0.1.2 lib/cabbage_doc/generators/api.rb
cabbage_doc-0.1.1 lib/cabbage_doc/generators/api.rb
cabbage_doc-0.1.0 lib/cabbage_doc/generators/api.rb
cabbage_doc-0.0.9 lib/cabbage_doc/generators/api.rb
cabbage_doc-0.0.8 lib/cabbage_doc/generators/api.rb