Sha256: c1ce6706042c97b8f41ae3cdd3979500475829ed8a761a783153a7c4356cef05

Contents?: true

Size: 647 Bytes

Versions: 11

Compression:

Stored size: 647 Bytes

Contents

require_relative '../swagger/operation'
require_relative '../swagger/tag'

module Swaggard
  module Parsers
    class Controllers

      def run(yard_objects, routes)
        tag = nil
        operations = []

        yard_objects.each do |yard_object|
          if yard_object.type == :class
            tag = Swagger::Tag.new(yard_object)
          elsif tag && yard_object.type == :method
            operation = Swagger::Operation.new(yard_object, tag, routes)
            operations << operation if operation.valid?
          end
        end

        return unless operations.any?

        return tag, operations
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
swaggard-0.5.4 lib/swaggard/parsers/controllers.rb
swaggard-0.5.3 lib/swaggard/parsers/controllers.rb
swaggard-0.5.2 lib/swaggard/parsers/controllers.rb
swaggard-0.5.1 lib/swaggard/parsers/controllers.rb
swaggard-0.5.0 lib/swaggard/parsers/controllers.rb
swaggard-0.4.0 lib/swaggard/parsers/controllers.rb
swaggard-0.3.0 lib/swaggard/parsers/controllers.rb
swaggard-0.2.1 lib/swaggard/parsers/controllers.rb
swaggard-0.2.0 lib/swaggard/parsers/controllers.rb
swaggard-0.1.1 lib/swaggard/parsers/controllers.rb
swaggard-0.1.0 lib/swaggard/parsers/controllers.rb