Class: XMLRPC::XMLWriter::Simple
- Inherits:
-
Object
- Object
- XMLRPC::XMLWriter::Simple
- Includes:
- Element
- Defined in:
- lib/xmlrpc/create.rb
Instance Method Summary collapse
- #document(*params) ⇒ Object
- #document_to_str(doc) ⇒ Object
- #element(name, attrs, *children) ⇒ Object
- #pi(name, *params) ⇒ Object
- #text(txt) ⇒ Object
Methods included from Element
Instance Method Details
#document(*params) ⇒ Object
33 34 35 |
# File 'lib/xmlrpc/create.rb', line 33 def document(*params) params.join("") end |
#document_to_str(doc) ⇒ Object
29 30 31 |
# File 'lib/xmlrpc/create.rb', line 29 def document_to_str(doc) doc end |
#element(name, attrs, *children) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/xmlrpc/create.rb', line 41 def element(name, attrs, *children) raise "attributes not yet implemented" unless attrs.nil? if children.empty? "<#{name}/>" else "<#{name}>" + children.join("") + "</#{name}>" end end |
#pi(name, *params) ⇒ Object
37 38 39 |
# File 'lib/xmlrpc/create.rb', line 37 def pi(name, *params) "<?#{name} " + params.join(" ") + " ?>" end |
#text(txt) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/xmlrpc/create.rb', line 50 def text(txt) cleaned = txt.dup cleaned.gsub!(/&/, '&') cleaned.gsub!(/</, '<') cleaned.gsub!(/>/, '>') cleaned end |