Module: Kernel

Defined in:
lib/gg/core.rb

Instance Method Summary collapse

Instance Method Details

#gg(*args, &block) ⇒ Object



10
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
38
39
40
41
42
43
44
# File 'lib/gg/core.rb', line 10

def gg(*args, &block)
  #ap args
  #ap caller
  #$gg << "<h1>JFKLDJSKLFSDJKL</h1>"
  #ap '======================'
  #ap args.size
  stack = gg_caller
  history = GG::State.new
  history.instance_eval(&block) if block
  # case args.size
  # when 1
    # $gg << GG.render( 'slim/logger.slim', { stack: stack } ) do
      # args[0].to_hi_html({})
    # end
  # else
  
  # RENDER HTML
  $gg << GG.render( 'slim/logger_with_multiple_variables.slim', 
    line: caller[0],
    objects: args,
    history: history,
    stack: stack
  )
  
  # RENDER CONSOLE
  begin
    $gg.console_array << '-'*79
    $gg.console_array << caller[0]
    $gg.console_array << stack[0].code_line.strip
    $gg.console_array << '-'*79
    $gg.console_array << args.ai({})
  rescue => e
    $gg.console_array << e.inspect
  end
end

#gg_caller(start = 1) ⇒ Object



4
5
6
7
8
# File 'lib/gg/core.rb', line 4

def gg_caller(start=1)
  # we add another +1 because we have to remove the current #hi_caller call
  # from the stack.
  GG::Stack.new(caller(start+1))
end

#gg_render_error(e) ⇒ Object



46
47
48
# File 'lib/gg/core.rb', line 46

def gg_render_error(e)
  "<span class=\"gg-error\">error in gg: #{Rack::Utils.escape_html(e.inspect)}</span>"
end

#gg_render_recursiveObject



50
51
52
# File 'lib/gg/core.rb', line 50

def gg_render_recursive
  "<span class=\"gg-recursive\">...recursive...</span>"
end