Module: AwesomePrint::Ripple

Defined in:
lib/awesome_print/ext/ripple.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
12
# File 'lib/awesome_print/ext/ripple.rb', line 9

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.




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

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

  if object.is_a?(::Ripple::AttributeMethods) # Module used to access attributes across documents and embedded documents
    cast = :ripple_document_instance
  elsif object.is_a?(::Ripple::Properties)    # Used to access property metadata on Ripple classes
    cast = :ripple_document_class
  end
  cast
end