Sha256: f83778569d7881d22789225e1b27ca3709d1cc011cba1b713b5c24b95517a41b

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

module Inch
  module Language
    module Nodejs
      module Provider
        module JSDoc
          module Object
            # Proxy class for function parameters
            class FunctionParameterObject
              attr_reader :name # @return [String]

              # @param method [YARD::Object::MethodObject] the method the
              #   parameter belongs to
              # @param name [String] the name of the parameter
              def initialize(method, name)
                @method = method
                @name = name
              end

              # @return [Boolean] +true+ if the parameter is a block
              def block?
                false
              end

              # @return [Boolean] +true+ if an additional description is given?
              def described?
                described_by_docstring?
              end

              # @return [Boolean] +true+ if the parameter is mentioned in the
              #   docs
              def mentioned?
                mentioned_by_docstring?
              end

              # @return [Boolean] +true+ if the parameter is a splat argument
              def splat?
                false
              end

              # @return [Boolean] +true+ if the type of the parameter is defined
              def typed?
                described_by_docstring?
              end

              # @return [Boolean] +true+ if the parameter is mentioned in the
              #   docs, but not present in the method's signature
              def wrongly_mentioned?
                false
              end

              private

              def described_by_docstring?
                @method.docstring.describes_parameter?(name)
              end

              def mentioned_by_docstring?
                @method.docstring.mentions_parameter?(name)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inch-0.5.10 lib/inch/language/nodejs/provider/jsdoc/object/function_parameter_object.rb