Module: XML::MappingExtensions
- Defined in:
- lib/xml/mapping_extensions.rb,
lib/xml/mapping_extensions/version.rb,
lib/xml/mapping_extensions/uri_node.rb,
lib/xml/mapping_extensions/date_node.rb,
lib/xml/mapping_extensions/namespace.rb,
lib/xml/mapping_extensions/node_base.rb,
lib/xml/mapping_extensions/time_node.rb,
lib/xml/mapping_extensions/namespaced.rb,
lib/xml/mapping_extensions/mime_type_node.rb,
lib/xml/mapping_extensions/typesafe_enum_node.rb
Overview
Additional mapping nodes and other utility classes for working with XML::Mapping
Defined Under Namespace
Modules: Namespaced Classes: DateNode, MimeTypeNode, Namespace, NodeBase, TimeNode, TypesafeEnumNode, UriNode
Constant Summary collapse
- VERSION =
The version of this gem
'0.4.9'.freeze
Class Method Summary collapse
-
.to_uri(url) ⇒ nil, URI
Ensures that the specified argument is a URI.
-
.to_uri_str(url) ⇒ nil, String
Ensures that the specified argument is a URI string.
Class Method Details
.to_uri(url) ⇒ nil, URI
Ensures that the specified argument is a URI.
17 18 19 20 21 22 |
# File 'lib/xml/mapping_extensions.rb', line 17 def self.to_uri(url) return nil unless url return url if url.is_a? URI stripped = url.respond_to?(:strip) ? url.strip : url.to_s.strip URI.parse(stripped) end |
.to_uri_str(url) ⇒ nil, String
Ensures that the specified argument is a URI string.
30 31 32 33 |
# File 'lib/xml/mapping_extensions.rb', line 30 def self.to_uri_str(url) uri = to_uri(url) uri && uri.to_s end |