Module: NS
- Defined in:
- lib/xml_schema/ns.rb
Class Method Summary collapse
-
.add(name, uri) ⇒ Object
Add a resource namespace.
Class Method Details
.add(name, uri) ⇒ Object
Add a resource namespace
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/xml_schema/ns.rb', line 8 def self.add(name, uri) ns_module = self.const_set(name, Module.new) ns_module.module_eval <<-HERE def self.uri URI(\"#{uri.sub(/\/?$/, '/')}\") end def self.to_s \"#{uri}\" end def self.[](value) URI(\"\#{self}#\#{value}\") end HERE end |