Module: XmlParsable
- Defined in:
- lib/xmlparsable.rb,
lib/xmlparsable/parser.rb,
lib/xmlparsable/elements.rb,
lib/xmlparsable/elements/xml.rb,
lib/xmlparsable/elements/date.rb,
lib/xmlparsable/elements/text.rb,
lib/xmlparsable/elements/time.rb,
lib/xmlparsable/elements/array.rb,
lib/xmlparsable/elements/record.rb,
lib/xmlparsable/elements/string.rb,
lib/xmlparsable/elements/numeric.rb,
lib/xmlparsable/elements/abstract.rb
Defined Under Namespace
Modules: ClassMethods, Elements
Classes: Parser
Class Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
17
18
19
20
|
# File 'lib/xmlparsable.rb', line 17
def self.included(base)
base.extend(ClassMethods)
base.__send__(:include, Elements)
end
|
.parser(input, *extra) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/xmlparsable.rb', line 8
def self.parser(input, *)
case input
when String then LibXML::XML::SaxParser.string(input, *)
when File then LibXML::XML::SaxParser.file(input, *)
when IO then LibXML::XML::SaxParser.io(input, *)
else raise ArgumentError, "argument must be a String, File, or IO"
end
end
|