In Files

  • irb/inspector.rb

IRB::INSPECTORS

Public Class Methods

def_inspector(key, arg=nil, &block) click to toggle source

ex) ::def_inspector(key, init_p=nil){|v| v.inspect} ::def_inspector, init_p=nil){|v| v.inspect} ::def_inspector(key, inspector) ::def_inspector, inspector)

 
               # File irb/inspector.rb, line 46
  def INSPECTORS.def_inspector(key, arg=nil, &block)
#     if !block_given?
#       case arg
#       when nil, Proc
#       inspector = IRB::Inspector(init_p)
#       when Inspector
#       inspector = init_p
#       else
#       IRB.Raise IllegalParameter, init_p
#       end
#       init_p = nil
#     else
#       inspector = IRB::Inspector(block, init_p)
#     end

    if block_given?
      inspector = IRB::Inspector(block, arg)
    else
      inspector = arg
    end

    case key
    when Array
      for k in key
        def_inspector(k, inspector)
      end
    when Symbol
      self[key] = inspector
      self[key.to_s] = inspector
    when String
      self[key] = inspector
      self[key.intern] = inspector
    else
      self[key] = inspector
    end
  end
            
keys_with_inspector(inspector) click to toggle source
 
               # File irb/inspector.rb, line 36
def INSPECTORS.keys_with_inspector(inspector)
  select{|k,v| v == inspector}.collect{|k, v| k}
end
            

Commenting is here to help enhance the documentation. For example, sample code, or clarification of the documentation.

If you are posting code samples in your comments, please wrap them in "<pre><code class="ruby" > ... </code></pre>" markup in order to get syntax highlighting.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file a bug report so that it can be corrected for the next release. Thank you.

blog comments powered by Disqus