Or how I debug.
Jason Wieringa
gem install pry
It's not a debugger.
It's an IRB alternative with different bells and whistles.
I have this method... it is long.
I didn't write it.
Of course.
But has MANY instance variables and there's something wrong with one of them.
I don't know which.
I could start doing this all over
puts @the_thing_I_want_to_see
But, it would be really great to step around the state and play with the code in real time.
Can I do that?
binding.pry
pry(#<AssessmentsController>)> cd Assessment
pry(Assessment):1>
pry(Assessment):1> ls
constants: END_DATE_OPTIONS MongoMapperAssociations MongoMapperKeys
Object.methods: yaml_tag
ActiveModel::Naming#methods: model_name
ActiveModel::Translation#methods: human_attribute_name lookup_ancestors
MongoMapper::Plugins::Document::ClassMethods#methods: embeddable?
pry(Assessment):1> show-method released?
From: /Users/jason/prj/codesherpas/complete_communicator/app/models/assessment.rb @ line 61:
Owner: Assessment
Visibility: public
Number of lines: 3
def released?
released
end
[74] pry(Assessment):1>
pry(Assessment):1> find-method to_yaml
Object
Object#psych_to_yaml
Object#to_yaml_properties
Object#to_yaml
pry(Assessment):1> show-source to_yaml
From: /Users/jason/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych/core_ext.rb @ line 13:
Owner: Object
Visibility: public
Number of lines: 3
def psych_to_yaml options = {}
Psych.dump self, options
end
Ruby!
instance_methods
instance_variables
More Pry
_ex_
wtf
gem install pry-debugger