Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active January 18, 2016 02:48
Show Gist options
  • Select an option

  • Save YumaInaura/97b0e3ee54352adc8eb5 to your computer and use it in GitHub Desktop.

Select an option

Save YumaInaura/97b0e3ee54352adc8eb5 to your computer and use it in GitHub Desktop.
Ruby | 継承元を除外して、新しく追加したメソッドだけを表示する方法 ref: http://qiita.com/Yinaura/items/c7f2a21a0f7eb3dc49cf
Example.methods(false)
Example.instance_methods(false)
class Example < BasicObject
def self.some_method
end
end
Example.methods
[:some_method, :allocate, :new, :superclass, :freeze, :===, :==,
:<=>, :<, :<=, :>, :>=, :to_s, :inspect, :included_modules, :include?, :name, :ancestors,
:instance_methods, :public_instance_methods, :protected_instance_methods,
:private_instance_methods, :constants, :const_get, :const_set, :const_defined?,
:const_missing, :class_variables, :remove_class_variable, :class_variable_get,
:class_variable_set, :class_variable_defined?, :public_constant, :private_constant,
:singleton_class?, :include, :prepend, :module_exec, :class_exec, :module_eval,
:class_eval, :method_defined?, :public_method_defined?, :private_method_defined?,
:protected_method_defined?, :public_class_method, :private_class_method, :autoload,
:autoload?, :instance_method, :public_instance_method, :nil?, :=~, :!~, :eql?, :hash,
:class, :singleton_class, :clone, :dup, :itself, :taint, :tainted?, :untaint, :untrust,
:untrusted?, :trust, :frozen?, :methods, :singleton_methods, :protected_methods,
:private_methods, :public_methods, :instance_variables, :instance_variable_get,
:instance_variable_set, :instance_variable_defined?, :remove_instance_variable,
:instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :extend,
:display, :method, :public_method, :singleton_method, :define_singleton_method,
:object_id, :to_enum, :enum_for, :equal?, :!, :!=, :instance_eval, :instance_exec,
:__send__, :__id__]
Example.methods(false)
[:some_method]
Example.instance_methods
Example.instance_methods(false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment