Class: Class

Inherits:
Object
  • Object
show all
Defined in:
lib/detest.rb

Overview

YAML raises this error when we try to serialize a class:

TypeError: can't dump anonymous class Class

Work around this by representing a class by its name.

Instance Method Summary collapse

Instance Method Details

#__to_yaml__Object



12
# File 'lib/detest.rb', line 12

alias __to_yaml__ to_yaml

#to_yaml(opts = {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/detest.rb', line 13

def to_yaml opts = {}
  begin
    __to_yaml__ opts
  rescue TypeError
    inspect.to_yaml opts
  end
end