Sha256: 043ae1510caff02c1a3dbc76325b8ca8d1de38ea8f9cc956d40d56f62b8f3142

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

module Inch
  module Language
    module Ruby
      module Provider
        # Parses the source tree (using YARD)
        module YARD
          # Returns +true+ if the docstring was generated by YARD
          #
          # @param docstring [Docstring,String]
          # @param method [MethodObject]
          def self.implicit_docstring?(docstring, method)
            name = method.name
            if method.getter?
              docstring.to_s == "Returns the value of attribute #{name}"
            elsif method.setter?
              basename = name.to_s.gsub(/(\=)$/, "")
              docstring.to_s == "Sets the attribute #{basename}"
            else
              false
            end
          end

          # Returns +true+ if the tag was generated by YARD
          #
          # @param tag [::YARD::Tag]
          # @param method [MethodObject]
          def self.implicit_tag?(tag, method)
            name = method.name
            if method.getter?
              tag.tag_name == "return" &&
                tag.text == "the current value of #{name}"
            elsif method.setter?
              tag.tag_name == "return" &&
                tag.text == "the newly set value"
            else
              false
            end
          end

          # @see Provider.parse
          def self.parse(dir, config)
            Parser.parse(dir, config)
          end
        end
      end
    end
  end
end

require "logger"
require "yard"

log.level = ::Logger::UNKNOWN # basically disable YARD's logging

require "inch/language/ruby/provider/yard/parser"
require "inch/language/ruby/provider/yard/docstring"
require "inch/language/ruby/provider/yard/nodoc_helper"
require "inch/language/ruby/provider/yard/object"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inch-0.5.0.rc5 lib/inch/language/ruby/provider/yard.rb
inch-0.5.0.rc4 lib/inch/language/ruby/provider/yard.rb