<commit_before>module Debugger
  class MethodCommand < Command # :nodoc:
    def regexp
      /^\s*m(?:ethod)?\s+(?:(i(:?nstance)?)\s)?/
    end

    def execute
      if @match[1]
        obj = debug_eval(@match.post_match)
        print "%s\n", columnize(obj.methods.sort(), 
                                self.class.settings[:width])
      else
        obj = debug_eval(@match.post_match)
        unless obj.kind_of? Module
          print "Should be Class/Module: %s\n", @match.post_match
        else
          print "%s\n", columnize(obj.instance_methods(false).sort(), 
                                  self.class.settings[:width])
        end
      end
    end

    class << self
      def help_command
        'method'
      end

      def help(cmd)
        %{
          m[ethod] i[nstance] <obj>\tshow methods of object
          m[ethod] <class|module>\t\tshow instance methods of class or module
        }
      end
    end
  end
end
<commit_msg>Add "method iv" (instance_variables)<commit_after>module Debugger
  class MethodCommand < Command # :nodoc:
    def regexp
      /^\s*m(?:ethod)?\s+((iv)|(i(:?nstance\s+)?)\s+)?/
    end

    def execute
      if @match[1] == "iv"
        obj = debug_eval(@match.post_match)
        obj.instance_variables.each do |v|
          print "%s = %s\n", v, obj.instance_variable_get(v)
        end
      elsif @match[1]
        obj = debug_eval(@match.post_match)
        print "%s\n", columnize(obj.methods.sort(), 
                                self.class.settings[:width])
      else
        obj = debug_eval(@match.post_match)
        unless obj.kind_of? Module
          print "Should be Class/Module: %s\n", @match.post_match
        else
          print "%s\n", columnize(obj.instance_methods(false).sort(), 
                                  self.class.settings[:width])
        end
      end
    end

    class << self
      def help_command
        'method'
      end

      def help(cmd)
        %{
          m[ethod] i[nstance] <obj>\tshow methods of object
          m[ethod] iv <obj>\tshow instance variables of object
          m[ethod] <class|module>\t\tshow instance methods of class or module
        }
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.12244897959183673, 'fraction_numerical': 0.0013605442176870747, 'mean_word_length': 1.767879548306148, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4019619', 'n_tokens_mistral': 686, 'n_tokens_neox': 670, 'n_words': 156}