xml_schema 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ xml_schema (0.1.1)
2
+
3
+ * NS.add to add custom namespaces
4
+ * added a few common namespaces
5
+
1
6
  xml_schema (0.1.0)
2
7
 
3
8
  * XmlSchema.datatype_of returns URI, not String
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xml_schema (0.0.1)
4
+ xml_schema (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/lib/xml_schema/ns.rb CHANGED
@@ -1,23 +1,19 @@
1
1
  require 'uri'
2
2
 
3
3
  module NS
4
-
5
- ALL = {
6
- 'XMLSchema' => 'http://www.w3.org/2001/XMLSchema',
7
- 'OWL' => 'http://www.w3.org/2002/07/owl',
8
- 'RDF' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns',
9
- 'RDFS' => 'http://www.w3.org/2000/01/rdf-schema'
10
- }
11
-
12
- ALL.each do |name, url|
4
+ # Add a resource namespace
5
+ #
6
+ # @param [String] name name of the module
7
+ # @param [String] uri URI of the resource
8
+ def self.add(name, uri)
13
9
  ns_module = self.const_set(name, Module.new)
14
10
  ns_module.module_eval <<-HERE
15
11
  def self.uri
16
- URI(\"#{url}\")
12
+ URI(\"#{uri.sub(/\/?$/, '/')}\")
17
13
  end
18
14
 
19
15
  def self.to_s
20
- \"#{url}\"
16
+ \"#{uri}\"
21
17
  end
22
18
 
23
19
  def self.[](value)
@@ -25,5 +21,11 @@ module NS
25
21
  end
26
22
  HERE
27
23
  end
28
-
29
24
  end
25
+
26
+ NS.add 'XMLSchema', 'http://www.w3.org/2001/XMLSchema'
27
+ NS.add 'OWL', 'http://www.w3.org/2002/07/owl'
28
+ NS.add 'RDF', 'http://www.w3.org/1999/02/22-rdf-syntax-ns'
29
+ NS.add 'RDFS', 'http://www.w3.org/2000/01/rdf-schema'
30
+ NS.add 'FOAF', 'http://xmlns.com/foaf/0.1'
31
+ NS.add 'DC', 'http://purl.org/dc'
@@ -1,3 +1,3 @@
1
1
  module XmlSchema
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-23 00:00:00.000000000 Z
12
+ date: 2012-07-29 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Helper methods and constants to handle XmlSchema
15
15
  email: