Module: Arrow::HtmlInspectableObject

Includes:
HTMLUtilities
Defined in:
lib/arrow/mixins.rb

Overview

Add a #html_inspect method to the including object that is capable of dumping its state as an HTML fragment.

  class MyObject
      include HtmlInspectableObject
  end

  irb> MyObject.new.html_inspect
     ==> "<span class=\"immediate-object\">#&lt;MyObject:0x56e780&gt;</span>"

Constant Summary

Constants included from HTMLUtilities

ARRAY_HTML_CONTAINER, HASH_HTML_CONTAINER, HASH_PAIR_HTML, IMMEDIATE_OBJECT_HTML_CONTAINER, IVAR_HTML_FRAGMENT, OBJECT_HTML_CONTAINER, THREAD_DUMP_KEY

Instance Method Summary

Methods included from HTMLUtilities

#escape_html, #make_html_for_object, #make_object_html_wrapper

Instance Method Details

- (Object) html_inspect

Return the receiver as an HTML fragment.



302
303
304
305
306
307
308
# File 'lib/arrow/mixins.rb', line 302

def html_inspect
  if self.instance_variables.empty?
    return make_html_for_object( self )
  else
    return make_object_html_wrapper( self )
  end
end