rshade

https://github.com/gingray/rshade


Keywords
debug, ruby, trace
License
MIT
Install
gem install rshade -v 0.1.3

Documentation

RShade

warcraft shade

Ruby Shade or RShade gem to help you to reveal what lines of code are used in program execution.

trace = RShade::Trace.new  
trace.reveal do  
  #your code here
end
trace.show
#rspec
 rshade_reveal do
   #code here
 end 

Example

I've took example from https://github.com/spree/spree code base. Wrap code to take a look what code is in use when you save variant. On such huge codebase as spree it's helpful to know what callbacks are triggered and so on.

  context '#cost_currency' do
    context 'when cost currency is nil' do
      before { variant.cost_currency = nil }

      it 'populates cost currency with the default value on save', focus: true do
        rshade_reveal do
          variant.save!
        end
        expect(variant.cost_currency).to eql 'USD'
      end
    end
  end

Below is example how output will look like. As you can see all code that have been in use is printed. asciicast

Installation

Add this line to your application's Gemfile:

gem 'rshade'  

TODO

Use stack to keep connections between current method and caller
take a look on https://github.com/matugm/visual-call-graph

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/gingray/rshade.

License

The gem is available as open source under the terms of the MIT License.