<commit_before># Looksee [![Build Status](https://travis-ci.org/oggy/looksee.png)](https://travis-ci.org/oggy/looksee) [![Gem Version](https://badge.fury.io/rb/looksee.svg)](http://badge.fury.io/rb/looksee)

A tool for illustrating the ancestry and method lookup path of
objects. Handy for exploring unfamiliar codebases.

## How

Install me:

    gem install looksee

Pop this in your `.irbrc`:

    require 'looksee'

Now each object has a method `ls`, which shows you all its methods.

    irb> [].ls
    => BasicObject
      !       __send__       instance_exec             singleton_method_undefined
      !=      equal?         method_missing
      ==      initialize     singleton_method_added
      __id__  instance_eval  singleton_method_removed
    Kernel
      !~                       frozen?                     puts
      <=>                      gem                         raise
      ===                      gem_original_require        rand
      =~                       gets                        readline
      Array                    global_variables            readlines
      Complex                  hash                        remove_instance_variable
      Float                    initialize_clone            require
      Integer                  initialize_copy             require_relative
      Rational                 initialize_dup              respond_to?
      String                   inspect                     respond_to_missing?
      __callee__               instance_of?                select
      __method__               instance_variable_defined?  send
      `                        instance_variable_get       set_trace_func
      abort                    instance_variable_set       singleton_class
      at_exit                  instance_variables          singleton_methods
      autoload                 is_a?                       sleep
      autoload?                iterator?                   spawn
      binding                  kind_of?                    sprintf
      block_given?             lambda                      srand
      caller                   load                        syscall
      catch                    local_variables             system
      class                    loop                        taint
      clone                    method                      tainted?
      define_singleton_method  methods                     tap
      display                  nil?                        test
      dup                      object_id                   throw
      enum_for                 open                        to_enum
      eql?                     p                           to_s
      eval                     print                       trace_var
      exec                     printf                      trap
      exit                     private_methods             trust
      exit!                    proc                        untaint
      extend                   protected_methods           untrace_var
      fail                     public_method               untrust
      fork                     public_methods              untrusted?
      format                   public_send                 warn
      freeze                   putc
    Looksee::ObjectMixin
      ls
    Object
      default_src_encoding  irb_binding
    Enumerable
      all?            each_cons         flat_map  min_by        slice_before
      any?            each_entry        grep      minmax        sort
      chunk           each_slice        group_by  minmax_by     sort_by
      collect         each_with_index   include?  none?         take
      collect_concat  each_with_object  inject    one?          take_while
      count           entries           map       partition     to_a
      cycle           find              max       reduce        to_set
      detect          find_all          max_by    reject        zip
      drop            find_index        member?   reverse_each
      drop_while      first             min       select
    Array
      &            count       hash             rassoc                size
      *            cycle       include?         reject                slice
      +            delete      index            reject!               slice!
      -            delete_at   initialize       repeated_combination  sort
      <<           delete_if   initialize_copy  repeated_permutation  sort!
      <=>          drop        insert           replace               sort_by!
      ==           drop_while  inspect          reverse               take
      []           each        join             reverse!              take_while
      []=          each_index  keep_if          reverse_each          to_a
      assoc        empty?      last             rindex                to_ary
      at           eql?        length           rotate                to_s
      clear        fetch       map              rotate!               transpose
      collect      fill        map!             sample                uniq
      collect!     find_index  pack             select                uniq!
      combination  first       permutation      select!               unshift
      compact      flatten     pop              shift                 values_at
      compact!     flatten!    product          shuffle               zip
      concat       frozen?     push             shuffle!              |

Methods are colored according to whether they're public, protected,
private, undefined (using Module#undef_method), or overridden.

You can hide, say, private methods like this:

    irb> [].ls :noprivate

Or filter the list by Regexp:

    irb> [].ls /^to_/
     => BasicObject
    Kernel
      to_enum  to_s
    Looksee::ObjectMixin
    Object
      to_yaml  to_yaml_properties  to_yaml_style
    Enumerable
      to_a  to_set
    Array
      to_a  to_ary  to_s  to_yaml

## Proxy objects

Objects that delegate everything via `method_missing` to some other object can
be tricky, because they will delegate `ls` itself. To view such objects, you can
always do:

    Looksee[object]

This method inspects the object via interpreter extensions, so it works for the
most Byzantine object. It will also work for `BasicObject` instances that don't
have an `ls` method. `Object#ls` is simply a wrapper around `Looksee.[]`.

## To the source!

If you want to know more about any of those methods, Looksee can
take you straight to the source in your editor:

    [].ls.edit :to_set

By default, this uses `vi`; customize it like this:

    # %f = file, %l = line number
    Looksee.editor = "mate -l%l %f"

## Quick Reference

We've got one:

    Looksee.help

Enjoy!

## Support

Looksee supports:

 * MRI 1.9.3, 2.0, 2.1
 * JRuby 1.7
 * Rubinius 2.2

## Contributing<commit_msg>Mention Looksee.rename in README.<commit_after># Looksee [![Build Status](https://travis-ci.org/oggy/looksee.png)](https://travis-ci.org/oggy/looksee) [![Gem Version](https://badge.fury.io/rb/looksee.svg)](http://badge.fury.io/rb/looksee)

A tool for illustrating the ancestry and method lookup path of
objects. Handy for exploring unfamiliar codebases.

## How

Install me:

    gem install looksee

Pop this in your `.irbrc`:

    require 'looksee'

Now each object has a method `ls`, which shows you all its methods.

    irb> [].ls
    => BasicObject
      !       __send__       instance_exec             singleton_method_undefined
      !=      equal?         method_missing
      ==      initialize     singleton_method_added
      __id__  instance_eval  singleton_method_removed
    Kernel
      !~                       frozen?                     puts
      <=>                      gem                         raise
      ===                      gem_original_require        rand
      =~                       gets                        readline
      Array                    global_variables            readlines
      Complex                  hash                        remove_instance_variable
      Float                    initialize_clone            require
      Integer                  initialize_copy             require_relative
      Rational                 initialize_dup              respond_to?
      String                   inspect                     respond_to_missing?
      __callee__               instance_of?                select
      __method__               instance_variable_defined?  send
      `                        instance_variable_get       set_trace_func
      abort                    instance_variable_set       singleton_class
      at_exit                  instance_variables          singleton_methods
      autoload                 is_a?                       sleep
      autoload?                iterator?                   spawn
      binding                  kind_of?                    sprintf
      block_given?             lambda                      srand
      caller                   load                        syscall
      catch                    local_variables             system
      class                    loop                        taint
      clone                    method                      tainted?
      define_singleton_method  methods                     tap
      display                  nil?                        test
      dup                      object_id                   throw
      enum_for                 open                        to_enum
      eql?                     p                           to_s
      eval                     print                       trace_var
      exec                     printf                      trap
      exit                     private_methods             trust
      exit!                    proc                        untaint
      extend                   protected_methods           untrace_var
      fail                     public_method               untrust
      fork                     public_methods              untrusted?
      format                   public_send                 warn
      freeze                   putc
    Looksee::ObjectMixin
      ls
    Object
      default_src_encoding  irb_binding
    Enumerable
      all?            each_cons         flat_map  min_by        slice_before
      any?            each_entry        grep      minmax        sort
      chunk           each_slice        group_by  minmax_by     sort_by
      collect         each_with_index   include?  none?         take
      collect_concat  each_with_object  inject    one?          take_while
      count           entries           map       partition     to_a
      cycle           find              max       reduce        to_set
      detect          find_all          max_by    reject        zip
      drop            find_index        member?   reverse_each
      drop_while      first             min       select
    Array
      &            count       hash             rassoc                size
      *            cycle       include?         reject                slice
      +            delete      index            reject!               slice!
      -            delete_at   initialize       repeated_combination  sort
      <<           delete_if   initialize_copy  repeated_permutation  sort!
      <=>          drop        insert           replace               sort_by!
      ==           drop_while  inspect          reverse               take
      []           each        join             reverse!              take_while
      []=          each_index  keep_if          reverse_each          to_a
      assoc        empty?      last             rindex                to_ary
      at           eql?        length           rotate                to_s
      clear        fetch       map              rotate!               transpose
      collect      fill        map!             sample                uniq
      collect!     find_index  pack             select                uniq!
      combination  first       permutation      select!               unshift
      compact      flatten     pop              shift                 values_at
      compact!     flatten!    product          shuffle               zip
      concat       frozen?     push             shuffle!              |

Methods are colored according to whether they're public, protected,
private, undefined (using Module#undef_method), or overridden.

You can hide, say, private methods like this:

    irb> [].ls :noprivate

Or filter the list by Regexp:

    irb> [].ls /^to_/
     => BasicObject
    Kernel
      to_enum  to_s
    Looksee::ObjectMixin
    Object
      to_yaml  to_yaml_properties  to_yaml_style
    Enumerable
      to_a  to_set
    Array
      to_a  to_ary  to_s  to_yaml

## Proxy objects

Objects that delegate everything via `method_missing` to some other object can
be tricky, because they will delegate `ls` itself. To view such objects, you can
always do:

    Looksee[object]

This method inspects the object via interpreter extensions, so it works for the
most Byzantine object. It will also work for `BasicObject` instances that don't
have an `ls` method. `Object#ls` is simply a wrapper around `Looksee.[]`.

## `ls` in your way?

If you have a library that for some reason can't handle an `ls` method existing
on `Object`, you may rename it like this:

    Looksee.rename ls: :_ls

## To the source!

If you want to know more about any of those methods, Looksee can
take you straight to the source in your editor:

    [].ls.edit :to_set

By default, this uses `vi`; customize it like this:

    # %f = file, %l = line number
    Looksee.editor = "mate -l%l %f"

## Quick Reference

We've got one:

    Looksee.help

Enjoy!

## Support

Looksee supports:

 * MRI 1.9.3, 2.0, 2.1
 * JRuby 1.7
 * Rubinius 2.2

## Contributing
{'fraction_non_alphanumeric': 0.03818287204752934, 'fraction_numerical': 0.0015939718881321549, 'mean_word_length': 1.0561596901534336, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4576039', 'n_tokens_mistral': 3286, 'n_tokens_neox': 3107, 'n_words': 1002}