Module: AwesomePrint::ContractValueObject

Defined in:
lib/contract_value_object/awesome_print.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/contract_value_object/awesome_print.rb', line 3

def self.included(base)
  base.send :alias_method, :cast_without_cvo, :cast
  base.send :alias_method, :cast, :cast_with_cvo
end

Instance Method Details

#awesome_contract_value_object(object) ⇒ Object



16
17
18
# File 'lib/contract_value_object/awesome_print.rb', line 16

def awesome_contract_value_object(object)
  "#{object.class} #{awesome_hash(object.to_h)}"
end

#cast_with_cvo(object, type) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/contract_value_object/awesome_print.rb', line 8

def cast_with_cvo(object, type)
  cast = cast_without_cvo(object, type)
  if (defined?(::ContractValueObject)) && (object.is_a?(::ContractValueObject))
    cast = :contract_value_object
  end
  cast
end