Sha256: cb9f69f091b86b82ad8b1360f41c374b4dc2bc06059284f66e6774fd85d64a06
Contents?: true
Size: 732 Bytes
Versions: 6
Compression:
Stored size: 732 Bytes
Contents
require 'nokogiri' # <message> # <to>$TO</to> # <body>$BODY</body> # </message> module Esendex class Message attr_accessor :to, :body, :from def initialize(to, body, from=nil) @to = to @body = body @from = from end def xml_node doc = Nokogiri::XML('<message/>') to = Nokogiri::XML::Node.new 'to', doc to.content = @to doc.root.add_child(to) body = Nokogiri::XML::Node.new 'body', doc body.content = @body doc.root.add_child(body) if @from from = Nokogiri::XML::Node.new 'from', doc from.content = @from doc.root.add_child(from) end doc.root end end end
Version data entries
6 entries across 6 versions & 1 rubygems