Sha256: 29c2caa7f9a138697a99051edc0f2d444a4a365ad0c5b2fe0df11583cb7e3aee
Contents?: true
Size: 1.13 KB
Versions: 6
Compression:
Stored size: 1.13 KB
Contents
class Evil::Client # # Utility to remove unnecessary methods from instances # to clear a namespace # @private # module Names extend self # Removes unused instance methods inherited from [Object] from given class # # @param [Class] klass # @return [nil] # def clean(klass) (klass.instance_methods - BasicObject.instance_methods - FORBIDDEN) .each { |m| klass.send(:undef_method, m) if m[FORMAT] } && nil end # List of preserved methods. # They also couldn't be used as names of operations/scopes/options # to avoid name conflicts. FORBIDDEN = %i[ basic_auth class datetime hash inspect instance_exec instance_variable_get instance_variable_set key_auth logger logger object_id operation operations options schema scope scopes self send settings singleton_class tap to_s to_str token_auth ].freeze # Matches whether a name can be used in operations/scopes/options FORMAT = /^[a-z]([a-z\d_])*[a-z\d]$/ end end
Version data entries
6 entries across 6 versions & 1 rubygems