gg 0.9.10 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +4 -4
- data/Gemfile +4 -4
- data/README.md +93 -93
- data/Rakefile +49 -49
- data/gg.gemspec +28 -28
- data/lib/gg.rb +38 -37
- data/lib/gg/core.rb +102 -101
- data/lib/gg/demo_app.rb +93 -76
- data/lib/gg/history.rb +20 -0
- data/lib/gg/logger.rb +40 -40
- data/lib/gg/public/gg.css +122 -122
- data/lib/gg/rack_plugin.rb +85 -85
- data/lib/gg/slim/_logger.slim +7 -7
- data/lib/gg/slim/array.slim +8 -8
- data/lib/gg/slim/hash.slim +11 -11
- data/lib/gg/slim/history.slim +11 -11
- data/lib/gg/slim/index.slim +18 -12
- data/lib/gg/slim/logger_with_multiple_variables.slim +11 -11
- data/lib/gg/slim/object.slim +2 -2
- data/lib/gg/slim/object_with_instance_variables.slim +9 -9
- data/lib/gg/slim/string.slim +3 -3
- data/lib/gg/version.rb +3 -3
- metadata +2 -1
data/.gitignore
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
*.gem
|
2
|
-
.bundle
|
3
|
-
Gemfile.lock
|
4
|
-
pkg/*
|
1
|
+
*.gem
|
2
|
+
.bundle
|
3
|
+
Gemfile.lock
|
4
|
+
pkg/*
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in gg.gemspec
|
4
|
-
gemspec
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in gg.gemspec
|
4
|
+
gemspec
|
data/README.md
CHANGED
@@ -1,93 +1,93 @@
|
|
1
|
-
# GG
|
2
|
-
|
3
|
-
## Rails Setup
|
4
|
-
|
5
|
-
Add the following to your Gemfile
|
6
|
-
```ruby
|
7
|
-
gem "gg"
|
8
|
-
```
|
9
|
-
|
10
|
-
Add the following to /config/application.rb
|
11
|
-
```ruby
|
12
|
-
module Editors
|
13
|
-
class Application < Rails::Application
|
14
|
-
config.middleware.use GG
|
15
|
-
```
|
16
|
-
|
17
|
-
|
18
|
-
## WARNINGS! Could not determine CONTENT-LENGTH of response body
|
19
|
-
|
20
|
-
The warning "Could not determine content-length of response body" is a
|
21
|
-
Webrick bug and not a GG bug. In production, if you use Thin, this
|
22
|
-
bug will disappear.
|
23
|
-
|
24
|
-
|
25
|
-
## Overview
|
26
|
-
|
27
|
-
GG is a debugging tool like FireBug but for Ruby Rack applications
|
28
|
-
like Rails and Sinatra. It lets you log variables/values to the browser while
|
29
|
-
you work on and debug your web application.
|
30
|
-
|
31
|
-
To use it, call "gg" from anywhere in your application followed by the
|
32
|
-
objects that you wish to log to the browser.
|
33
|
-
|
34
|
-
gg stands for the "gg" in "logger" but was also chosen because it is easy to
|
35
|
-
type, even when your right hand is on the mouse.
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
gg "Hello World"
|
39
|
-
```
|
40
|
-
|
41
|
-
Of course, it would be more useful to see the value of a variable:
|
42
|
-
|
43
|
-
```ruby
|
44
|
-
msg = "Hello World"
|
45
|
-
gg msg
|
46
|
-
```
|
47
|
-
|
48
|
-
GG will output to the screen the "gg msg" call, the call position and
|
49
|
-
the data.
|
50
|
-
|
51
|
-
It works with Hash and Array values as well as objects from custom classes.
|
52
|
-
|
53
|
-
```ruby
|
54
|
-
gg [ 1, 2, 3]
|
55
|
-
gg( :a => 'alpha' ) # note: you can't use gg{ :a => 'alpha' } because Ruby thinks its a block
|
56
|
-
gg MyObject.new( 'cool object' )
|
57
|
-
```
|
58
|
-
|
59
|
-
## Choosing Injection Points
|
60
|
-
|
61
|
-
GG always adds the required CSS file at the top of the <head> tag.
|
62
|
-
If there is no <head> tag then it adds it to the top of the content sent to
|
63
|
-
the browser.
|
64
|
-
|
65
|
-
GG tries to add the logging information in the HTML where it finds
|
66
|
-
<!--gg-->.
|
67
|
-
|
68
|
-
If it cannot find <!--gg--> then it adds the HTML to the top of the
|
69
|
-
page after the css link.
|
70
|
-
|
71
|
-
|
72
|
-
## Non-HTML requests (JSON, Images, etc.)
|
73
|
-
|
74
|
-
If you call gg during a non-HTML request like a txt, js or css file, GG
|
75
|
-
does not return the value to the screen since this would mess up your
|
76
|
-
application. When this happens, you can access your dump at:
|
77
|
-
|
78
|
-
/gg/history/0
|
79
|
-
|
80
|
-
Currently, GG is set up to store 10 dumps at:
|
81
|
-
|
82
|
-
/gg/history/0
|
83
|
-
...
|
84
|
-
/gg/history/9
|
85
|
-
|
86
|
-
|
87
|
-
## Build
|
88
|
-
|
89
|
-
rake build
|
90
|
-
|
91
|
-
## Install
|
92
|
-
|
93
|
-
rake install
|
1
|
+
# GG
|
2
|
+
|
3
|
+
## Rails Setup
|
4
|
+
|
5
|
+
Add the following to your Gemfile
|
6
|
+
```ruby
|
7
|
+
gem "gg"
|
8
|
+
```
|
9
|
+
|
10
|
+
Add the following to /config/application.rb
|
11
|
+
```ruby
|
12
|
+
module Editors
|
13
|
+
class Application < Rails::Application
|
14
|
+
config.middleware.use GG
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
## WARNINGS! Could not determine CONTENT-LENGTH of response body
|
19
|
+
|
20
|
+
The warning "Could not determine content-length of response body" is a
|
21
|
+
Webrick bug and not a GG bug. In production, if you use Thin, this
|
22
|
+
bug will disappear.
|
23
|
+
|
24
|
+
|
25
|
+
## Overview
|
26
|
+
|
27
|
+
GG is a debugging tool like FireBug but for Ruby Rack applications
|
28
|
+
like Rails and Sinatra. It lets you log variables/values to the browser while
|
29
|
+
you work on and debug your web application.
|
30
|
+
|
31
|
+
To use it, call "gg" from anywhere in your application followed by the
|
32
|
+
objects that you wish to log to the browser.
|
33
|
+
|
34
|
+
gg stands for the "gg" in "logger" but was also chosen because it is easy to
|
35
|
+
type, even when your right hand is on the mouse.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
gg "Hello World"
|
39
|
+
```
|
40
|
+
|
41
|
+
Of course, it would be more useful to see the value of a variable:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
msg = "Hello World"
|
45
|
+
gg msg
|
46
|
+
```
|
47
|
+
|
48
|
+
GG will output to the screen the "gg msg" call, the call position and
|
49
|
+
the data.
|
50
|
+
|
51
|
+
It works with Hash and Array values as well as objects from custom classes.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
gg [ 1, 2, 3]
|
55
|
+
gg( :a => 'alpha' ) # note: you can't use gg{ :a => 'alpha' } because Ruby thinks its a block
|
56
|
+
gg MyObject.new( 'cool object' )
|
57
|
+
```
|
58
|
+
|
59
|
+
## Choosing Injection Points
|
60
|
+
|
61
|
+
GG always adds the required CSS file at the top of the <head> tag.
|
62
|
+
If there is no <head> tag then it adds it to the top of the content sent to
|
63
|
+
the browser.
|
64
|
+
|
65
|
+
GG tries to add the logging information in the HTML where it finds
|
66
|
+
<!--gg-->.
|
67
|
+
|
68
|
+
If it cannot find <!--gg--> then it adds the HTML to the top of the
|
69
|
+
page after the css link.
|
70
|
+
|
71
|
+
|
72
|
+
## Non-HTML requests (JSON, Images, etc.)
|
73
|
+
|
74
|
+
If you call gg during a non-HTML request like a txt, js or css file, GG
|
75
|
+
does not return the value to the screen since this would mess up your
|
76
|
+
application. When this happens, you can access your dump at:
|
77
|
+
|
78
|
+
/gg/history/0
|
79
|
+
|
80
|
+
Currently, GG is set up to store 10 dumps at:
|
81
|
+
|
82
|
+
/gg/history/0
|
83
|
+
...
|
84
|
+
/gg/history/9
|
85
|
+
|
86
|
+
|
87
|
+
## Build
|
88
|
+
|
89
|
+
rake build
|
90
|
+
|
91
|
+
## Install
|
92
|
+
|
93
|
+
rake install
|
data/Rakefile
CHANGED
@@ -1,49 +1,49 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
|
3
|
-
# use "rake install" to create the gem
|
4
|
-
|
5
|
-
task 'demo' do
|
6
|
-
|
7
|
-
require File.join( File.dirname( __FILE__ ), 'lib/gg' )
|
8
|
-
|
9
|
-
app = Rack::Builder.app do
|
10
|
-
use Rack::ShowExceptions
|
11
|
-
use Rack::Reloader, 0
|
12
|
-
use GG
|
13
|
-
# Put this here to make sure that serving files like images aren't broken
|
14
|
-
# by the logger.
|
15
|
-
use Rack::Static, :urls => ["/images"], :root => "public"
|
16
|
-
#run HiLogger::DemoApp.new
|
17
|
-
run lambda { |env|
|
18
|
-
GG::DemoApp.new.call( env )
|
19
|
-
#gg 'Hello World'
|
20
|
-
#[ 200, { 'Content-Type' => 'text/html' }, [ "<h1>HiLogger</h1><p>This is a demo of HiLogger</p>"] ]
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
Rack::Handler::WEBrick.run( app )
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
# use this for testing to see that if you don't have the rack plugin installed,
|
30
|
-
# that it will display useful error messages to the console.
|
31
|
-
task 'rackless' do
|
32
|
-
|
33
|
-
require File.join( File.dirname( __FILE__ ), 'lib/gg' )
|
34
|
-
|
35
|
-
app = Rack::Builder.app do
|
36
|
-
use Rack::ShowExceptions
|
37
|
-
use Rack::Reloader, 0
|
38
|
-
# Put this here to make sure that serving files like images aren't broken
|
39
|
-
# by the logger.
|
40
|
-
use Rack::Static, :urls => ["/images"], :root => "public"
|
41
|
-
#run HiLogger::DemoApp.new
|
42
|
-
run lambda { |env|
|
43
|
-
GG::DemoApp.new.call( env )
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
Rack::Handler::WEBrick.run( app )
|
48
|
-
|
49
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
# use "rake install" to create the gem
|
4
|
+
|
5
|
+
task 'demo' do
|
6
|
+
|
7
|
+
require File.join( File.dirname( __FILE__ ), 'lib/gg' )
|
8
|
+
|
9
|
+
app = Rack::Builder.app do
|
10
|
+
use Rack::ShowExceptions
|
11
|
+
use Rack::Reloader, 0
|
12
|
+
use GG
|
13
|
+
# Put this here to make sure that serving files like images aren't broken
|
14
|
+
# by the logger.
|
15
|
+
use Rack::Static, :urls => ["/images"], :root => "public"
|
16
|
+
#run HiLogger::DemoApp.new
|
17
|
+
run lambda { |env|
|
18
|
+
GG::DemoApp.new.call( env )
|
19
|
+
#gg 'Hello World'
|
20
|
+
#[ 200, { 'Content-Type' => 'text/html' }, [ "<h1>HiLogger</h1><p>This is a demo of HiLogger</p>"] ]
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
Rack::Handler::WEBrick.run( app )
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# use this for testing to see that if you don't have the rack plugin installed,
|
30
|
+
# that it will display useful error messages to the console.
|
31
|
+
task 'rackless' do
|
32
|
+
|
33
|
+
require File.join( File.dirname( __FILE__ ), 'lib/gg' )
|
34
|
+
|
35
|
+
app = Rack::Builder.app do
|
36
|
+
use Rack::ShowExceptions
|
37
|
+
use Rack::Reloader, 0
|
38
|
+
# Put this here to make sure that serving files like images aren't broken
|
39
|
+
# by the logger.
|
40
|
+
use Rack::Static, :urls => ["/images"], :root => "public"
|
41
|
+
#run HiLogger::DemoApp.new
|
42
|
+
run lambda { |env|
|
43
|
+
GG::DemoApp.new.call( env )
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
Rack::Handler::WEBrick.run( app )
|
48
|
+
|
49
|
+
end
|
data/gg.gemspec
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "gg/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "gg"
|
7
|
-
s.version = GG::VERSION
|
8
|
-
s.authors = ["Sunny Hirai"]
|
9
|
-
s.email = ["thesunny@gmail.com"]
|
10
|
-
s.homepage = ""
|
11
|
-
s.summary = %q{Log to the Browser}
|
12
|
-
s.description = %q{Log to the Browser}
|
13
|
-
|
14
|
-
s.rubyforge_project = "gg"
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
# specify any dependencies here; for example:
|
22
|
-
# s.add_development_dependency "rspec"
|
23
|
-
# s.add_runtime_dependency "rest-client"
|
24
|
-
s.add_development_dependency 'rake'
|
25
|
-
s.add_dependency 'awesome_print'
|
26
|
-
s.add_dependency 'rack'
|
27
|
-
s.add_dependency 'slim'
|
28
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "gg/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "gg"
|
7
|
+
s.version = GG::VERSION
|
8
|
+
s.authors = ["Sunny Hirai"]
|
9
|
+
s.email = ["thesunny@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Log to the Browser}
|
12
|
+
s.description = %q{Log to the Browser}
|
13
|
+
|
14
|
+
s.rubyforge_project = "gg"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
s.add_development_dependency 'rake'
|
25
|
+
s.add_dependency 'awesome_print'
|
26
|
+
s.add_dependency 'rack'
|
27
|
+
s.add_dependency 'slim'
|
28
|
+
end
|
data/lib/gg.rb
CHANGED
@@ -1,38 +1,39 @@
|
|
1
|
-
require 'rack'
|
2
|
-
require 'awesome_print'
|
3
|
-
require 'slim'
|
4
|
-
require 'gg/version'
|
5
|
-
require 'gg/rack_plugin'
|
6
|
-
require 'gg/demo_app'
|
7
|
-
require 'gg/core'
|
8
|
-
require 'gg/logger'
|
9
|
-
require 'gg/
|
10
|
-
require 'gg/
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
1
|
+
require 'rack'
|
2
|
+
require 'awesome_print'
|
3
|
+
require 'slim'
|
4
|
+
require 'gg/version'
|
5
|
+
require 'gg/rack_plugin'
|
6
|
+
require 'gg/demo_app'
|
7
|
+
require 'gg/core'
|
8
|
+
require 'gg/logger'
|
9
|
+
require 'gg/history'
|
10
|
+
require 'gg/stack'
|
11
|
+
require 'gg/stack_line'
|
12
|
+
|
13
|
+
# For automatic integration into Rails
|
14
|
+
require "gg/railtie" if defined? Rails
|
15
|
+
|
16
|
+
class GG
|
17
|
+
|
18
|
+
def self.root
|
19
|
+
@root ||= File.join( File.dirname( __FILE__ ), 'gg' )
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.path( subpath )
|
23
|
+
File.join( root, subpath )
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.render( subpath, scope=nil, &block )
|
27
|
+
Tilt.new( GG.path( subpath ) ).render( scope, &block )
|
28
|
+
# if scope
|
29
|
+
# Tilt.new( GG.path( subpath ) ).render( scope, &block )
|
30
|
+
# elsif block_given?
|
31
|
+
# Tilt.new( GG.path( subpath ) ).render( &block )
|
32
|
+
# else
|
33
|
+
# raise ArgumentError, "Must provide one of scope or block"
|
34
|
+
# end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Your code goes here...
|
38
|
+
end
|
38
39
|
|
data/lib/gg/core.rb
CHANGED
@@ -1,102 +1,103 @@
|
|
1
|
-
|
2
|
-
module Kernel
|
3
|
-
|
4
|
-
def gg_caller(start=1)
|
5
|
-
# we add another +1 because we have to remove the current #hi_caller call
|
6
|
-
# from the stack.
|
7
|
-
GG::Stack.new(caller(start+1))
|
8
|
-
end
|
9
|
-
|
10
|
-
def gg(*args)
|
11
|
-
#ap args
|
12
|
-
#ap caller
|
13
|
-
#$gg << "<h1>JFKLDJSKLFSDJKL</h1>"
|
14
|
-
|
15
|
-
#ap args.size
|
16
|
-
stack = gg_caller
|
17
|
-
history =
|
18
|
-
# case args.size
|
19
|
-
# when 1
|
20
|
-
# $gg << GG.render( 'slim/logger.slim', { stack: stack } ) do
|
21
|
-
# args[0].to_hi_html({})
|
22
|
-
# end
|
23
|
-
# else
|
24
|
-
|
25
|
-
# RENDER HTML
|
26
|
-
$gg << GG.render( 'slim/logger_with_multiple_variables.slim',
|
27
|
-
line: caller[0],
|
28
|
-
objects: args,
|
29
|
-
history: history,
|
30
|
-
stack: stack
|
31
|
-
)
|
32
|
-
|
33
|
-
# RENDER CONSOLE
|
34
|
-
$gg.console_array << <<-EOF
|
35
|
-
#{'-'*79}
|
36
|
-
#{caller[0]}
|
37
|
-
#{stack[0].code_line.strip}
|
38
|
-
#{'.'*79}
|
39
|
-
#{args.ai({})}
|
40
|
-
EOF
|
41
|
-
# end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
class Object
|
47
|
-
|
48
|
-
def to_hi_html(history)
|
49
|
-
history[self]
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
history[self]
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
history[self]
|
100
|
-
|
101
|
-
|
1
|
+
|
2
|
+
module Kernel
|
3
|
+
|
4
|
+
def gg_caller(start=1)
|
5
|
+
# we add another +1 because we have to remove the current #hi_caller call
|
6
|
+
# from the stack.
|
7
|
+
GG::Stack.new(caller(start+1))
|
8
|
+
end
|
9
|
+
|
10
|
+
def gg(*args)
|
11
|
+
#ap args
|
12
|
+
#ap caller
|
13
|
+
#$gg << "<h1>JFKLDJSKLFSDJKL</h1>"
|
14
|
+
#ap '======================'
|
15
|
+
#ap args.size
|
16
|
+
stack = gg_caller
|
17
|
+
history = GG::History.new
|
18
|
+
# case args.size
|
19
|
+
# when 1
|
20
|
+
# $gg << GG.render( 'slim/logger.slim', { stack: stack } ) do
|
21
|
+
# args[0].to_hi_html({})
|
22
|
+
# end
|
23
|
+
# else
|
24
|
+
|
25
|
+
# RENDER HTML
|
26
|
+
$gg << GG.render( 'slim/logger_with_multiple_variables.slim',
|
27
|
+
line: caller[0],
|
28
|
+
objects: args,
|
29
|
+
history: history,
|
30
|
+
stack: stack
|
31
|
+
)
|
32
|
+
|
33
|
+
# RENDER CONSOLE
|
34
|
+
$gg.console_array << <<-EOF
|
35
|
+
#{'-'*79}
|
36
|
+
#{caller[0]}
|
37
|
+
#{stack[0].code_line.strip}
|
38
|
+
#{'.'*79}
|
39
|
+
#{args.ai({})}
|
40
|
+
EOF
|
41
|
+
# end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
class Object
|
47
|
+
|
48
|
+
def to_hi_html(history)
|
49
|
+
return "...recursive..." if history[self]
|
50
|
+
history[self] = true
|
51
|
+
if self.instance_variables.size == 0
|
52
|
+
GG.render('slim/object.slim',
|
53
|
+
object: self,
|
54
|
+
classname: "hi-#{ self.class }",
|
55
|
+
history: history
|
56
|
+
)
|
57
|
+
else
|
58
|
+
GG.render('slim/object_with_instance_variables.slim',
|
59
|
+
object: self,
|
60
|
+
classname: "hi-#{ self.class }",
|
61
|
+
history: history
|
62
|
+
)
|
63
|
+
end
|
64
|
+
# Rack::Utils.escape_html( self.inspect )
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
class Numeric
|
70
|
+
|
71
|
+
def to_hi_html(history)
|
72
|
+
GG.render('slim/object.slim', object: self, classname: "hi-Numeric")
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
class String
|
78
|
+
|
79
|
+
def to_hi_html(history)
|
80
|
+
GG.render('slim/string.slim', self)
|
81
|
+
#Tilt.new( GG.path( 'string.slim' ) ).render( self )
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
class Array
|
87
|
+
|
88
|
+
def to_hi_html(history)
|
89
|
+
return "...recursive..." if history[self]
|
90
|
+
history[self] = true
|
91
|
+
GG.render('slim/array.slim', object: self, history: history)
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
class Hash
|
97
|
+
|
98
|
+
def to_hi_html(history)
|
99
|
+
return "...recursive..." if history[self]
|
100
|
+
history[self] = true
|
101
|
+
GG.render('slim/hash.slim', object: self, history: history)
|
102
|
+
end
|
102
103
|
end
|