Sha256: 0c3116a13d7c242a68936487965ec89e1d0cc8f54d8a57bcdbaec71299d36364

Contents?: true

Size: 630 Bytes

Versions: 6

Compression:

Stored size: 630 Bytes

Contents

module Swaggard
  module Swagger
    class Tag

      attr_accessor :name, :description

      attr_reader :controller_class

      def initialize(yard_object)
        @yard_name = yard_object.name
        @controller_class = "#{yard_object.namespace}::#{yard_object.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

6 entries across 6 versions & 1 rubygems

Version Path
swaggard-0.3.0 lib/swaggard/swagger/tag.rb
swaggard-0.2.1 lib/swaggard/swagger/tag.rb
swaggard-0.2.0 lib/swaggard/swagger/tag.rb
swaggard-0.1.1 lib/swaggard/swagger/tag.rb
swaggard-0.1.0 lib/swaggard/swagger/tag.rb
swaggard-0.0.4 lib/swaggard/swagger/tag.rb