inspectbang 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +34 -0
  2. data/inspectbang.gemspec +13 -0
  3. data/lib/inspectbang.rb +21 -0
  4. metadata +64 -0
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ Inspect with a bang!
2
+ ====================
3
+
4
+
5
+ Easy peasy "puts" style debugging in your browser, for Rails. Use the
6
+ `Object#inspect!` method to output an HTML safe representation of the
7
+ object in your browser.
8
+
9
+
10
+ Installation
11
+ ------------
12
+
13
+ Add inspectbang to your Gemfile and run `bundle`:
14
+
15
+ ```ruby
16
+ group :development do
17
+ gem 'inspectbang', '~> 1.0.0'
18
+ end
19
+ ```
20
+
21
+
22
+ Usage
23
+ -----
24
+
25
+ Just call the `inspect!` method on any object. For example, here's how you
26
+ would inspect the form data that was posted to your application:
27
+
28
+ ```ruby
29
+ class SomeController < ApplicationController
30
+ def some_form_action
31
+ params.inspect!
32
+ end
33
+ end
34
+ ```
@@ -0,0 +1,13 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'inspectbang'
3
+ s.version = '1.0.0'
4
+ s.platform = Gem::Platform::RUBY
5
+ s.authors = ['Tim Craft']
6
+ s.email = ['mail@timcraft.com']
7
+ s.homepage = 'http://github.com/timcraft/inspectbang'
8
+ s.description = 'Inspect with a bang!'
9
+ s.summary = 'See description'
10
+ s.files = %w(lib/inspectbang.rb README.md inspectbang.gemspec)
11
+ s.add_dependency('rails', ['>= 3.0.3'])
12
+ s.require_path = 'lib'
13
+ end
@@ -0,0 +1,21 @@
1
+ require 'cgi'
2
+
3
+ module InspectBang
4
+ class Exception < StandardError; end
5
+
6
+ module Method
7
+ def inspect!
8
+ raise Exception.new(self.inspect)
9
+ end
10
+ end
11
+
12
+ class Railtie < Rails::Railtie
13
+ initializer 'inspectbang' do |app|
14
+ ActionController::Base.rescue_from(Exception) do |exception|
15
+ render :text => CGI.escapeHTML(exception.message)
16
+ end
17
+
18
+ Object.send(:include, Method)
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: inspectbang
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tim Craft
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.0.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.3
30
+ description: Inspect with a bang!
31
+ email:
32
+ - mail@timcraft.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/inspectbang.rb
38
+ - README.md
39
+ - inspectbang.gemspec
40
+ homepage: http://github.com/timcraft/inspectbang
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project:
60
+ rubygems_version: 1.8.24
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: See description
64
+ test_files: []