Class: DebugExtras::Dumper

Inherits:
Object
  • Object
show all
Includes:
ActionView::Context, ActionView::Helpers::TagHelper
Defined in:
lib/debug_extras/dumper.rb

Instance Method Summary collapse

Constructor Details

#initialize(dump, settings) ⇒ Dumper

Returns a new instance of Dumper.



9
10
11
12
# File 'lib/debug_extras/dumper.rb', line 9

def initialize(dump, settings)
  @dump = dump
  @settings = settings
end

Instance Method Details

#render {|message| ... } ⇒ Object

Yields:

  • (message)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/debug_extras/dumper.rb', line 14

def render
  message = (:div, class: 'debug-extras') do
    @settings.merge! Settings.ap_options

    output = @dump.ai Settings.ap_options
    output = render_object_names output
    output = add_styles_to_tag(:pre, output)
    output = add_styles_to_tag(:kbd, output)

    output.html_safe
  end

  yield message if block_given?

  message
end