123456789_123456789_123456789_123456789_123456789_

Module: XMLRPC::ParserWriterChooseMixin

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/xmlrpc/utils.rb

Overview

Defines ParserWriterChooseMixin, which makes it possible to choose a different XMLWriter and/or XMLParser then the default one.

The Mixin is used in client.rb (class Client) and server.rb (class BasicServer)

Instance Method Summary

Instance Method Details

#create (private)

[ GitHub ]

  
# File 'lib/xmlrpc/utils.rb', line 47

def create
  # if set_writer was not already called then call it now
  if @create.nil? then
    set_writer(Config::DEFAULT_WRITER.new)
  end
  @create
end

#parser (private)

[ GitHub ]

  
# File 'lib/xmlrpc/utils.rb', line 55

def parser
  # if set_parser was not already called then call it now
  if @parser.nil? then
    set_parser(Config::DEFAULT_PARSER.new)
  end
  @parser
end

#set_parser(parser)

Sets the XMLParser to use for parsing XML documents.

Should be an instance of a class from module XMLParser.

If this method is not called, then Config::DEFAULT_PARSER is used.

[ GitHub ]

  
# File 'lib/xmlrpc/utils.rb', line 40

def set_parser(parser)
  @parser = parser
  self
end

#set_writer(writer)

Sets the XMLWriter to use for generating XML output.

Should be an instance of a class from module XMLWriter.

If this method is not called, then Config::DEFAULT_WRITER is used.

[ GitHub ]

  
# File 'lib/xmlrpc/utils.rb', line 30

def set_writer(writer)
  @create = Create.new(writer)
  self
end