Sha256: cae2992cf83a286410425789c15f2c796c09515f4b5bb4608bd0f8be7ef9bbe3

Contents?: true

Size: 1.53 KB

Versions: 48

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true
class YARD::Handlers::C::MethodHandler < YARD::Handlers::C::Base
  MATCH1 = /rb_define_
                 (
                    singleton_method |
                    method           |
                    module_function  |
                    private_method
                 )
                 \s*\(\s*([\w\.]+)\s*,
                   \s*"([^"]+)"\s*,
                   \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(\w+\))?(\w+)\)?\s*,
                   \s*(-?\w+)\s*\)/xm
  MATCH2 = /rb_define_global_function\s*\(
                \s*"([^"]+)",
                \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(\w+\))?(\w+)\)?,
                \s*(-?\w+)\s*\)/xm
  MATCH3 = /define_filetest_function\s*\(
                \s*"([^"]+)",
                \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(\w+\))?(\w+)\)?,
                \s*(-?\w+)\s*\)/xm
  handles MATCH1
  handles MATCH2
  handles MATCH3
  statement_class BodyStatement

  process do
    statement.source.scan(MATCH1) do |type, var_name, name, func_name, _param_count|
      break if var_name == "ruby_top_self"
      break if var_name == "nstr"
      break if var_name == "envtbl"

      var_name = "rb_cObject" if var_name == "rb_mKernel"
      handle_method(type, var_name, name, func_name)
    end

    statement.source.scan(MATCH2) do |name, func_name, _param_count|
      handle_method("method", "rb_mKernel", name, func_name)
    end

    statement.source.scan(MATCH3) do |name, func_name, _param_count|
      handle_method("singleton_method", "rb_cFile", name, func_name)
    end
  end
end

Version data entries

48 entries across 48 versions & 6 rubygems

Version Path
yard-0.9.33 lib/yard/handlers/c/method_handler.rb
yard-0.9.32 lib/yard/handlers/c/method_handler.rb
yard-0.9.31 lib/yard/handlers/c/method_handler.rb
yard-0.9.30 lib/yard/handlers/c/method_handler.rb
yard-0.9.29 lib/yard/handlers/c/method_handler.rb
devcycle-ruby-server-sdk-2.0.0 vendor/bundle/ruby/3.0.0/gems/yard-0.9.28/lib/yard/handlers/c/method_handler.rb
kinetic_sdk-5.0.20 gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
yard-0.9.28 lib/yard/handlers/c/method_handler.rb
yard-0.9.27 lib/yard/handlers/c/method_handler.rb
yard-0.9.26 lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.35 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.34 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.33 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.32 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.31 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.30 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.29 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.28 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.27 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb
qiita_org-0.1.26 gems/ruby/2.7.0/gems/yard-0.9.25/lib/yard/handlers/c/method_handler.rb