Sha256: b1b1541efd9a9dc53396d5654876dc28f4dd622fbf26795d4f92227a2e7f498a

Contents?: true

Size: 740 Bytes

Versions: 3

Compression:

Stored size: 740 Bytes

Contents

# encoding: utf-8

module Yardstick
  module Rules
    # Checks if method has @example tag
    #
    # This applies only for public methods
    #
    class ExampleTag < Rule
      self.description = 'The public/semipublic method should have an example specified'

      # @see class description
      #
      # @return [Boolean]
      #   true if method is not private and it returns something meaningful
      #
      # @api private
      def validatable?
        !api?(%w[ private ]) && tag_types('return') != %w[ undefined ]
      end

      # @see class description
      #
      # @return [Boolean]
      #   true if has example tag
      #
      # @api private
      def valid?
        has_tag?('example')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yardstick-0.9.9 lib/yardstick/rules/example_tag.rb
yardstick-0.9.8 lib/yardstick/rules/example_tag.rb
yardstick-0.9.7 lib/yardstick/rules/example_tag.rb