Sha256: 350b63d5a8b095240dae0e719475bb4151bd322c7eef846cdd267798c865415f

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'yard'

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

          handles /\Aproperty\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 #{nobj}.#{name}(repository=nil)"
              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

            register MethodObject.new(nobj, "#{name}=", mscope) do |o|
              o.visibility = :public
              o.source = statement.source
              o.signature = "def #{name}=(value)"
              o.parameters = [['value', nil]]
            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/property_handler.rb