Last active
December 20, 2019 16:47
-
-
Save hanachin/428f82b9ae44e0da779ff1d9398425b8 to your computer and use it in GitHub Desktop.
ruby-signatureのディレクトリで実行して足りてなさそうな定義を調べたい人むけのスニペットです
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| klass_or_module = Object.constants.map(&Object.method(:const_get)).select {|klass| klass.is_a?(Class) || klass.is_a?(Module) } | |
| tarinai = {} | |
| klass_or_module.each do |klass| | |
| tarinai[klass.name.to_s] = klass.public_instance_methods(false) - `exe/rbs methods #{klass.name} | cut -f1 -d" " | sort`.split.map(&:to_sym) | |
| end | |
| tarinai_singleton = {} | |
| klass_or_module.each do |klass| | |
| tarinai_singleton[klass.name.to_s] = klass.singleton_methods - `exe/rbs methods --singleton #{klass.name} | cut -f1 -d" " | sort`.split.map(&:to_sym) | |
| end | |
| totemotarinai = {} | |
| tarinai.each do |k, v| | |
| next if v.empty? | |
| totemotarinai[k] ||= {} | |
| totemotarinai[k][:public_instance_methods] = v | |
| end | |
| tarinai_singleton.each do |k, v| | |
| next if v.empty? | |
| totemotarinai[k] ||= {} | |
| totemotarinai[k][:singleton_methods] = v | |
| end | |
| require 'json' | |
| File.write('tarinai.json', JSON.pretty_generate(tarinai.reject { _2.empty? }.to_h)) | |
| File.write('tarinai_singleton.json', JSON.pretty_generate(tarinai_singleton.reject { _2.empty? }.to_h)) | |
| # puts JSON.pretty_generate(totemotarinai.reject { _2.empty? }.to_h) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "IO": [ | |
| "pread", | |
| "pwrite", | |
| "set_encoding_by_bom", | |
| "external_encoding", | |
| "write_nonblock" | |
| ], | |
| "LoadError": [ | |
| "path" | |
| ], | |
| "NameError": [ | |
| "receiver", | |
| "name" | |
| ], | |
| "NoMethodError": [ | |
| "args", | |
| "private_call?" | |
| ], | |
| "FrozenError": [ | |
| "receiver" | |
| ], | |
| "SystemCallError": [ | |
| "errno" | |
| ], | |
| "Array": [ | |
| "intersection", | |
| "filter!", | |
| "flatten!", | |
| "bsearch", | |
| "bsearch_index", | |
| "deconstruct", | |
| "replace", | |
| "pack", | |
| "dig" | |
| ], | |
| "Hash": [ | |
| "deconstruct_keys", | |
| "dig", | |
| "index", | |
| "default_proc", | |
| "default_proc=", | |
| "transform_keys", | |
| "transform_keys!", | |
| "transform_values", | |
| "transform_values!", | |
| "fetch_values", | |
| "slice", | |
| "update", | |
| "merge!" | |
| ], | |
| "Proc": [ | |
| "yield", | |
| "<<", | |
| ">>", | |
| "ruby2_keywords" | |
| ], | |
| "LocalJumpError": [ | |
| "exit_value", | |
| "reason" | |
| ], | |
| "Encoding": [ | |
| "_dump" | |
| ], | |
| "UnboundMethod": [ | |
| "original_name", | |
| "bind_call" | |
| ], | |
| "Enumerator": [ | |
| "+" | |
| ], | |
| "Fiber": [ | |
| "resume" | |
| ], | |
| "Struct": [ | |
| "members", | |
| "values_at", | |
| "[]", | |
| "[]=", | |
| "deconstruct", | |
| "each_pair", | |
| "dig", | |
| "values", | |
| "length", | |
| "size", | |
| "deconstruct_keys" | |
| ], | |
| "StopIteration": [ | |
| "result" | |
| ], | |
| "Thread": [ | |
| "set_trace_func" | |
| ], | |
| "GC": [ | |
| "garbage_collect" | |
| ], | |
| "TracePoint": [ | |
| "event", | |
| "parameters", | |
| "eval_script", | |
| "instruction_sequence" | |
| ], | |
| "Dir": [ | |
| "each_child", | |
| "children" | |
| ], | |
| "Monitor": [ | |
| "exit", | |
| "synchronize", | |
| "mon_check_owner", | |
| "wait_for_cond", | |
| "mon_try_enter", | |
| "try_enter", | |
| "try_mon_enter", | |
| "mon_enter", | |
| "mon_exit", | |
| "mon_locked?", | |
| "mon_owned?", | |
| "new_cond", | |
| "enter", | |
| "mon_synchronize" | |
| ], | |
| "MonitorMixin": [ | |
| "synchronize", | |
| "mon_try_enter", | |
| "try_mon_enter", | |
| "mon_enter", | |
| "mon_exit", | |
| "mon_locked?", | |
| "mon_owned?", | |
| "mon_synchronize", | |
| "new_cond" | |
| ], | |
| "Range": [ | |
| "%" | |
| ], | |
| "Module": [ | |
| "deprecate_constant", | |
| "const_source_location", | |
| "undef_method" | |
| ], | |
| "Kernel": [ | |
| "itself", | |
| "yield_self", | |
| "then", | |
| "respond_to?", | |
| "object_id" | |
| ], | |
| "Symbol": [ | |
| "start_with?", | |
| "end_with?" | |
| ], | |
| "Exception": [ | |
| "full_message" | |
| ], | |
| "Time": [ | |
| "floor", | |
| "ceil" | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "SystemExit": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "IO": [ | |
| "foreach", | |
| "pipe" | |
| ], | |
| "SignalException": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Interrupt": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "StandardError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "TypeError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "ArgumentError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "IndexError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "KeyError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Process": [ | |
| "spawn", | |
| "last_status", | |
| "setpgrp" | |
| ], | |
| "RangeError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "ScriptError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "SyntaxError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "LoadError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "NotImplementedError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "NameError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "NoMethodError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "RuntimeError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "FrozenError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "SecurityError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "NoMemoryError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "EncodingError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "SystemCallError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Warning": [ | |
| "[]", | |
| "[]=" | |
| ], | |
| "NoMatchingPatternError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Hash": [ | |
| "try_convert" | |
| ], | |
| "Integer": [ | |
| "sqrt" | |
| ], | |
| "Random": [ | |
| "urandom", | |
| "bytes", | |
| "random_number" | |
| ], | |
| "RbConfig": [ | |
| "fire_update!", | |
| "ruby", | |
| "expand" | |
| ], | |
| "LocalJumpError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "SystemStackError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Encoding": [ | |
| "_load", | |
| "locale_charmap" | |
| ], | |
| "UncaughtThrowError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "File": [ | |
| "lutime", | |
| "mkfifo", | |
| "absolute_path?", | |
| "empty?", | |
| "exists?", | |
| "foreach", | |
| "pipe" | |
| ], | |
| "ZeroDivisionError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "FloatDomainError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Enumerator": [ | |
| "produce" | |
| ], | |
| "Fiber": [ | |
| "yield" | |
| ], | |
| "FiberError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "RegexpError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Complex": [ | |
| "rectangular", | |
| "rect", | |
| "polar" | |
| ], | |
| "StopIteration": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "RubyVM": [ | |
| "stat" | |
| ], | |
| "GC": [ | |
| "stress=", | |
| "latest_gc_info", | |
| "compact", | |
| "verify_internal_consistency", | |
| "verify_compaction_references", | |
| "verify_transient_heap_internal_consistency" | |
| ], | |
| "ObjectSpace": [ | |
| "count_objects", | |
| "garbage_collect", | |
| "each_object", | |
| "define_finalizer", | |
| "undefine_finalizer", | |
| "_id2ref" | |
| ], | |
| "Gem": [ | |
| "platform_defaults", | |
| "activate_bin_path", | |
| "binary_mode", | |
| "bindir", | |
| "dir", | |
| "default_dir", | |
| "default_bindir", | |
| "clear_paths", | |
| "path", | |
| "config_file", | |
| "user_home", | |
| "configuration", | |
| "configuration=", | |
| "datadir", | |
| "deflate", | |
| "paths", | |
| "_deprecated_gunzip", | |
| "paths=", | |
| "_deprecated_gzip", | |
| "_deprecated_inflate", | |
| "_deprecated_detect_gemdeps", | |
| "spec_cache_dir", | |
| "ensure_gem_subdirectories", | |
| "ensure_subdirectories", | |
| "ensure_default_gem_subdirectories", | |
| "extension_api_version", | |
| "ruby_api_version", | |
| "find_files", | |
| "find_files_from_load_path", | |
| "suffix_pattern", | |
| "find_latest_files", | |
| "win_platform?", | |
| "gunzip", | |
| "gzip", | |
| "inflate", | |
| "install", | |
| "host", | |
| "host=", | |
| "load_path_insert_index", | |
| "add_to_load_path", | |
| "load_yaml", | |
| "location_of_caller", | |
| "marshal_version", | |
| "platforms=", | |
| "platforms", | |
| "post_build", | |
| "post_install", | |
| "done_installing", | |
| "post_reset", | |
| "post_uninstall", | |
| "pre_install", | |
| "pre_reset", | |
| "pre_uninstall", | |
| "prefix", | |
| "refresh", | |
| "read_binary", | |
| "write_binary", | |
| "ruby", | |
| "env_requirement", | |
| "latest_spec_for", | |
| "latest_rubygems_version", | |
| "latest_version_for", | |
| "ruby_version", | |
| "rubygems_version", | |
| "sources", | |
| "default_sources", | |
| "sources=", | |
| "suffixes", | |
| "suffix_regexp", | |
| "time", | |
| "ui", | |
| "use_paths", | |
| "java_platform?", | |
| "load_plugin_files", | |
| "load_plugins", | |
| "load_env_plugins", | |
| "use_gemdeps", | |
| "detect_gemdeps", | |
| "source_date_epoch", | |
| "gemdeps", | |
| "register_default_spec", | |
| "find_unresolved_default_spec", | |
| "clear_default_specs", | |
| "post_build_hooks", | |
| "post_install_hooks", | |
| "done_installing_hooks", | |
| "post_reset_hooks", | |
| "post_uninstall_hooks", | |
| "pre_install_hooks", | |
| "pre_reset_hooks", | |
| "pre_uninstall_hooks", | |
| "try_activate", | |
| "default_spec_cache_dir", | |
| "needs", | |
| "default_ext_dir_for", | |
| "finish_resolve", | |
| "default_rubygems_dirs", | |
| "default_specifications_dir", | |
| "user_dir", | |
| "loaded_specs", | |
| "ruby_engine", | |
| "path_separator", | |
| "default_path", | |
| "vendor_dir", | |
| "default_exec_format", | |
| "bin_path", | |
| "default_key_path", | |
| "default_cert_path", | |
| "install_extension_in_lib", | |
| "operating_system_defaults" | |
| ], | |
| "DidYouMean": [ | |
| "formatter", | |
| "correct_error", | |
| "formatter=" | |
| ], | |
| "Dir": [ | |
| "each_child", | |
| "children", | |
| "empty?", | |
| "exists?" | |
| ], | |
| "ThreadError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Marshal": [ | |
| "restore" | |
| ], | |
| "ClosedQueueError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "MonitorMixin": [ | |
| "extend_object" | |
| ], | |
| "Module": [ | |
| "used_modules" | |
| ], | |
| "Class": [ | |
| "used_modules" | |
| ], | |
| "EOFError": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "Kernel": [ | |
| "spawn", | |
| "trap", | |
| "set_trace_func", | |
| "trace_var", | |
| "untrace_var" | |
| ], | |
| "Exception": [ | |
| "exception", | |
| "to_tty?" | |
| ], | |
| "IOError": [ | |
| "exception", | |
| "to_tty?" | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment