ruby/rails/debugger variable dump question

Discussion in 'Ruby' started by Ralph Shnelvar, Dec 25, 2009.

  1. newb here.

    (OT: Merry Christmas, all.)

    So I placed a debugger statement into my ROR app and run
    ruby script/server webrick --debugger

    My app hit the debugger statement.

    I then did a
    var local

    ----------------------------------------------------------
    (rdb:68) var local
    _ =>
    exception => No route matches "/xxx" with {:method=>:get}
    handler => #<Method: #<ApplicationController:0x6018a3c @action_name="index", @_response=#<ActionController::Response:0x6018b40 @session={"flash"=>{}}, @redirected_to=nil,

    [snipped a ton of stuff]

    "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,
    application/xml;q=0.9,*/*;q=0.8", "REQUEST_METHOD"=>"GET", "HTTP_CONNECTION"=>"keep-alive"}, @request_method=:get, @parameters={}>, @parameters={}>>.__bind_1261677328_946000>
    (rdb:68)
    ----------------------------------------------------------


    I have no idea how to interpret this or format this for pretty output.

    So ... by guess and by gosh (and because I read it somewhere) I then ran irb inside the debugger and did



    ----------------------------------------------------------
    (rdb:68) @_response
    #<ActionController::Response:0x6018b40 @session={"flash"=>{}}, @redirected_to=nil, @writer=#<Proc:0x0612469c@f:/Ralph-Rails-Apps/authlogic/vendor/rails/actionpack/lib/action_controller/response.rb:46>, @request=#<ActionController::Request:0x6018b68

    [snipped a ton of stuff]

    @assigns={}, @helpers=#<ActionView::Base::proxyModule:0x6018960>>, @body=["",
    nil, [], []], @assigns=[], @header={"Cache-Control"=>"no-cache"}, @status=200>
    ----------------------------------------------------------



    Since that was no better, I tried (because I saw it somewhere)
    y @_response
    inside irb

    I don't even see y documented as a debugger command.

    ----------------------------------------------------------

    irb(#<ApplicationController:0x6018a3c>):002:0> y @_response
    --- &id007 !ruby/object:ActionController::Response
    assigns: &id001 []

    block:
    body:
    - ""
    -
    - *id001
    - []

    header: &id005 !map:Rack::Utils::HeaderHash
    Cache-Control: no-cache
    redirected_to:
    request: &id003 !ruby/object:ActionController::Request
    content_type:
    env:
    rack.session.record: !ruby/object:ActiveRecord::SessionStore::Session
    attributes:
    updated_at: 2009-12-24 06:54:00
    session_id: fab30d62f08ae89e5b87d68bb1647c3c
    id: "1"
    created_at: 2009-12-24 06:54:00
    data: |
    BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
    SGFzaHsABjoKQHVzZWR7AA==

    attributes_cache: {}

    data:
    flash: &id002 !map:ActionController::Flash::FlashHash {}

    action_controller.rescue.request: *id003
    SERVER_NAME: localhost
    rack.request.cookie_hash:
    _session_id: fab30d62f08ae89e5b87d68bb1647c3c

    [snipped a ton of stuff]

    request: *id003
    helpers: !ruby/object:ActionView::Base::proxyModule
    receiver: *id008
    view_paths: !seq:ActionView::pathSet
    - !ruby/object:ActionView::ReloadableTemplate::ReloadablePath
    disk_cache: {}

    path: f:/Ralph-Rails-Apps/authlogic/app/views
    paths: {}

    writer: !ruby/object:proc {}

    => nil
    irb(#<ApplicationController:0x6018a3c>):003:0>

    ----------------------------------------------------------




    That's a bit better but still mostly uninterpretable to me.

    So ... how would I get programmatic access to, say, SERVER_NAME or the _session_id?

    Is there documentation on how to use the debugger?
    Ralph Shnelvar, Dec 25, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. halfdog
    Replies:
    12
    Views:
    12,446
  2. questions?

    debugger/core dump(strange!!!)

    questions?, Jan 5, 2006, in forum: C Programming
    Replies:
    8
    Views:
    361
    questions?
    Jan 5, 2006
  3. Josef 'Jupp' SCHUGT
    Replies:
    5
    Views:
    174
    Stephan Kämper
    Jan 24, 2006
  4. Jason Wong
    Replies:
    0
    Views:
    168
    Jason Wong
    Nov 20, 2007
  5. Robert Oschler
    Replies:
    1
    Views:
    222
    Mcginkel
    Sep 5, 2005
Loading...

Share This Page