module Gapic::RubyInfo

Various Ruby language information useful for generators.

Public Class Methods

excluded_method_names() click to toggle source

A sorted list of method names that generated code should avoid. This includes methods of the Object class (including BasicObject and Kernel), Ruby keywords, and a few special names including “initialize” and “configure”.

@return [Array<String>]

# File lib/gapic/ruby_info.rb, line 84
def excluded_method_names
  @excluded_method_names ||= begin
    object_methods = (Object.instance_methods + Object.private_instance_methods).map(&:to_s)
    other_methods = ["configure", "initialize"]
    (object_methods + other_methods + keywords).sort.freeze
  end
end
keywords() click to toggle source

A sorted list of Ruby's keywords.

@see docs.ruby-lang.org/en/2.7.0/keywords_rdoc.html

@return [Array<String>]

# File lib/gapic/ruby_info.rb, line 30
def keywords
  @keywords ||= [
    "__ENCODING__",
    "__LINE__",
    "__FILE__",
    "BEGIN",
    "END",
    "alias",
    "and",
    "begin",
    "break",
    "case",
    "class",
    "def",
    "defined?",
    "do",
    "else",
    "elsif",
    "end",
    "ensure",
    "false",
    "for",
    "if",
    "in",
    "module",
    "next",
    "nil",
    "not",
    "or",
    "redo",
    "rescue",
    "retry",
    "return",
    "self",
    "super",
    "then",
    "true",
    "undef",
    "unless",
    "until",
    "when",
    "while",
    "yield"
  ].freeze
end