<commit_before>X-ray is the missing link between browser and editor. Visualize your Backbone views and Rails templates in an overlay, and click them to open up their respective files in your editor.

This is in proof-of-concept stage. It does appear to be a workable idea.<commit_msg>README updates<commit_after># Xray

### Reveal the structure of your UI.

The dev tools available to web developers in modern browsers are great. Many of us can't remember what life was like before "Inspect Element". But what we see in the compiled output sent to our browser is often the wrong level of detail - what about being able to visualize the higher level components of your UI? Controllers, templates, partials, Backbone views, etc. On top of that, why in 2013 can I not click something in the browser and have the code revealed in my editor of choice?

Xray is the missing link between the browser and your app code.

**Disclaimer:** Xray is in early stages and currently supports only Rails 3.1+ with use of the asset pipeline as a requirement.

### Installation

Add to your Gemfile:

```ruby
gem 'xray-rails'
```

Then run bundle and delete your cached assets:

```
$ bundle && rm -rf tmp/cache/assets
```

Restart your app, open your browser, and press `cmd+ctrl+x` to see the overlay.

### How this works

* During asset compilation, JS files and templates are augmented to contain file path information.
* On each request, a bit of information is gathered and put into `Xray.request_info` to be used by the dev bar.
* A middleware inserts `xray.js`, `xray.css`, and the Xray bar to all successful HTML response bodies.
* When the overlay is shown, `xray.js` examines the augmented file path information inserted during asset compilation.
* Another middleware piggybacks the Rails server to respond to requests to open file paths with the user's desired editor.
{'fraction_non_alphanumeric': 0.056958624395486296, 'fraction_numerical': 0.0032240730789897904, 'mean_word_length': 4.350574712643678, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3536192', 'n_tokens_mistral': 489, 'n_tokens_neox': 461, 'n_words': 292}