Sha256: ffc6e377ad356c37be923610700eb4d942631189fa254ebb62acae38b3c7a8d5

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 Bytes

Contents

require 'yard'

module YARD
  module Handlers
    module Ruby
      module Legacy
        class HasHandler < Base

          handles /\Ahas\s+([1-9]\d*|n|(0|1)\.\.n),\s/

          def process
            nobj = namespace
            mscope = scope
            name = statement.tokens[2..-1].to_s[/:[^,]+/][1..-1]

            register MethodObject.new(nobj, name, :class) do |o|
              o.visibility = :public
              o.source = statement.source
              o.signature = "def self.#{name}"
              o.parameters = [['repository', 'nil']]
            end

            register MethodObject.new(nobj, name, mscope) do |o|
              o.visibility = :public
              o.source = statement.source
              o.signature = "def #{name}"
            end
          end

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ronin-0.3.0 lib/ronin/yard/handlers/ruby/legacy/has_handler.rb