166: def yaml_inline= bool
167: if respond_to?("to_yaml_style")
168: self.to_yaml_style = :inline
169: else
170: unless defined? @__yaml_inline_meth
171: @__yaml_inline_meth =
172: lambda {|opts|
173: YAML::quick_emit(object_id, opts) {|emitter|
174: emitter << '{ ' << map{|kv| kv.join ': '}.join(', ') << ' }'
175: }
176: }
177: class << self
178: def to_yaml opts = {}
179: begin
180: @__yaml_inline ? @__yaml_inline_meth[ opts ] : super
181: rescue
182: @to_yaml_style = :inline
183: super
184: end
185: end
186: end
187: end
188: end
189: @__yaml_inline = bool
190: end