Module: AmazingPrint::Ripple

Included in:
Formatter
Defined in:
lib/amazing_print/ext/ripple.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



10
11
12
13
# File 'lib/amazing_print/ext/ripple.rb', line 10

def self.included(base)
  base.send :alias_method, :cast_without_ripple, :cast
  base.send :alias_method, :cast, :cast_with_ripple
end

Instance Method Details

#cast_with_ripple(object, type) ⇒ Object

Add Ripple class names to the dispatcher pipeline.




17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/amazing_print/ext/ripple.rb', line 17

def cast_with_ripple(object, type)
  cast = cast_without_ripple(object, type)
  return cast unless defined?(::Ripple)

  case object
  when ::Ripple::AttributeMethods # Module used to access attributes across documents and embedded documents
    cast = :ripple_document_instance
  when ::Ripple::Properties # Used to access property metadata on Ripple classes
    cast = :ripple_document_class
  end
  cast
end