Module: AwesomePrint::AXElements

Defined in:
lib/ax_elements/awesome_print.rb

Overview

AwesomePrint extension for AXElements.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Perform the silly alias_method_chain stuff that AwesomePrint expects.


10
11
12
13
# File 'lib/ax_elements/awesome_print.rb', line 10

def self.included base
  base.send :alias_method, :cast_without_ax_elements, :cast
  base.send :alias_method, :cast, :cast_with_ax_elements
end

Instance Method Details

#cast_with_ax_elements(object, type) ⇒ Object

Format AX::Element objects for AwesomePrint. For the time being, just work-around the default AwesomePrint output by using the default #inpspect for AX::Element.


19
20
21
22
23
# File 'lib/ax_elements/awesome_print.rb', line 19

def cast_with_ax_elements object, type
  cast = cast_without_ax_elements object, type
  cast = :ax_element if object.kind_of? ::AX::Element
  cast
end