Module: AmazingPrint::OpenStruct
- Included in:
- Formatter
- Defined in:
- lib/amazing_print/ext/ostruct.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
10 11 12 13 |
# File 'lib/amazing_print/ext/ostruct.rb', line 10 def self.included(base) base.send :alias_method, :cast_without_ostruct, :cast base.send :alias_method, :cast, :cast_with_ostruct end |
Instance Method Details
#awesome_open_struct_instance(object) ⇒ Object
21 22 23 |
# File 'lib/amazing_print/ext/ostruct.rb', line 21 def awesome_open_struct_instance(object) "#{object.class} #{awesome_hash(object.marshal_dump)}" end |
#cast_with_ostruct(object, type) ⇒ Object
15 16 17 18 19 |
# File 'lib/amazing_print/ext/ostruct.rb', line 15 def cast_with_ostruct(object, type) cast = cast_without_ostruct(object, type) cast = :open_struct_instance if defined?(::OpenStruct) && object.is_a?(::OpenStruct) cast end |