summaryrefslogtreecommitdiff
path: root/lib/psych/ruby.rb
blob: f63fee1bd5a04fa3c2acc75fdbbee13e35acf9a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
[Object, String, Class, Hash, Array].each do |klass|
  klass.send(:remove_method, :to_yaml)
end

class Object
  include Psych::Visitable

  def to_yaml options = {}
    visitor = Psych::Visitors::YASTBuilder.new options
    visitor.accept self
    visitor.tree.to_yaml
  end
end