Sha256: 423cbef546d53d53f2460eb8fde451dea88618930f2a39cc6a6ab6db4dff8613

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

module Swaggard
  module Swagger
    class Tag

      attr_accessor :name, :description

      attr_reader :controller_class

      def initialize(yard_object)
        controller_name = "#{yard_object.namespace}::#{yard_object.name}"

        @yard_name = yard_object.name
        @controller_class = controller_name.constantize

        tag = yard_object.tags.find { |tag| tag.tag_name == 'tag' }

        @name =  tag ? tag.text : "#{@controller_class.controller_path}"
        @description = yard_object.docstring || ''
      end

      def to_doc
        {
          'name'        => @name,
          'description' => @description
        }
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
swaggard-1.0.1 lib/swaggard/swagger/tag.rb
swaggard-1.0.0 lib/swaggard/swagger/tag.rb
swaggard-0.5.4 lib/swaggard/swagger/tag.rb