Class: ActiveRecord::Coders::XML
- Inherits:
-
Object
- Object
- ActiveRecord::Coders::XML
- Defined in:
- lib/pg-xml/coder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #dump(xml_document) ⇒ Object
-
#initialize(default = nil) ⇒ XML
constructor
A new instance of XML.
- #load(xml_string) ⇒ Object
Constructor Details
#initialize(default = nil) ⇒ XML
Returns a new instance of XML.
13 14 15 |
# File 'lib/pg-xml/coder.rb', line 13 def initialize(default=nil) @default=default end |
Class Method Details
.dump(xml_document) ⇒ Object
9 10 11 |
# File 'lib/pg-xml/coder.rb', line 9 def self.dump(xml_document) new(PgXML.default).dump(xml_document) end |
.load(xml_string) ⇒ Object
5 6 7 |
# File 'lib/pg-xml/coder.rb', line 5 def self.load(xml_string) new(PgXML.default).load(xml_string) end |
Instance Method Details
#dump(xml_document) ⇒ Object
17 18 19 |
# File 'lib/pg-xml/coder.rb', line 17 def dump(xml_document) (xml_document.nil? && @default.nil?) ? nil : PgXML.dump( xml_document || @default ) end |
#load(xml_string) ⇒ Object
21 22 23 |
# File 'lib/pg-xml/coder.rb', line 21 def load(xml_string) xml_string.nil? ? @default : PgXML.load(xml_string) end |