Module: Gapic::RubyInfo
- Defined in:
- lib/gapic/ruby_info.rb
Overview
Various Ruby language information useful for generators.
Class Method Summary collapse
-
.excluded_method_names ⇒ Array<String>
A sorted list of method names that generated code should avoid.
-
.keywords ⇒ Array<String>
A sorted list of Ruby's keywords.
Class Method Details
.excluded_method_names ⇒ Array<String>
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".
84 85 86 87 88 89 90 |
# 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 ⇒ Array<String>
A sorted list of Ruby's keywords.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# 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 |