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

Arrow::HTMLUtilities::ARRAY_HTML_CONTAINER, Arrow::HTMLUtilities::HASH_HTML_CONTAINER, Arrow::HTMLUtilities::HASH_PAIR_HTML, Arrow::HTMLUtilities::IMMEDIATE_OBJECT_HTML_CONTAINER, Arrow::HTMLUtilities::IVAR_HTML_FRAGMENT, Arrow::HTMLUtilities::OBJECT_HTML_CONTAINER, Arrow::HTMLUtilities::THREAD_DUMP_KEY

Instance Method Summary collapse

Methods included from HTMLUtilities

escape_html, make_html_for_object, make_object_html_wrapper

Instance Method Details

#html_inspectObject

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