iq_rdf 0.1.10 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd960bbb4300cd34a14a36d26bcc626f6b876433
4
+ data.tar.gz: 8e33531c579111188e0a497a9f9315629e8b23cf
5
+ SHA512:
6
+ metadata.gz: 01c41e39063401936dc1c60f4161e3737c2ea1233cd7575a413eb60d52c454f2df6f6cac42202ba220a0a65c04858f2c6f426f41f79140d70e387ab747f45493
7
+ data.tar.gz: 94b8a2dd418f6b3d1647a653a7d056becc73b828f764a1621b6b40ffd92fe277b0b0aa542fcb7b0bd357d8d017bbaaa8549a7a683a3007cc371859a72307cef7
@@ -77,4 +77,12 @@ module IqRdf
77
77
  Namespace.dummy_empty_namespace.build_uri(uri, type, &block)
78
78
  end
79
79
 
80
+ def self.find_or_create_namespace_class(klass_name)
81
+ if RUBY_VERSION < "1.9"
82
+ self.const_defined?(klass_name) ? self.const_get(klass_name) : self.const_set(klass_name, Class.new(IqRdf::Namespace))
83
+ else
84
+ self.const_defined?(klass_name) ? self.const_get(klass_name) : self.const_set(klass_name, Class.new(IqRdf::Namespace))
85
+ end
86
+ end
87
+
80
88
  end
@@ -12,8 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- require 'active_support'
16
-
17
15
  module IqRdf
18
16
  class Literal
19
17
 
@@ -52,7 +50,7 @@ module IqRdf
52
50
  end
53
51
 
54
52
  def to_ntriples(parent_lang = nil)
55
- additional_quote = @obj.to_s.include?("\n") ? '""' : ''
53
+ quote = @obj.to_s.include?("\n") ? '"""' : '"'
56
54
  suffix = if @datatype.is_a?(::URI)
57
55
  "^^<#{@datatype.to_s}>"
58
56
  elsif @datatype.is_a?(IqRdf::Uri)
@@ -62,7 +60,7 @@ module IqRdf
62
60
  (lang && lang != :none) ? "@#{lang}" : ""
63
61
  end
64
62
 
65
- "#{additional_quote}#{ActiveSupport::JSON.encode(@obj.to_s).gsub('\\n', "\n")}#{additional_quote}#{suffix}"
63
+ "#{quote}#{@obj.to_s.gsub("\\", "\\\\\\\\").gsub(/"/, "\\\"")}#{quote}#{suffix}"
66
64
  end
67
65
 
68
66
  def build_xml(xml, &block)
@@ -40,8 +40,7 @@ module IqRdf
40
40
  # Namespace only methods
41
41
 
42
42
  def self.create(token, uri_prefix)
43
- klass_name = self.class_name(token)
44
- klass = IqRdf.const_defined?(klass_name) ? IqRdf.const_get(klass_name) : IqRdf.const_set(klass_name, Class.new(self))
43
+ klass = IqRdf.find_or_create_namespace_class(self.class_name(token))
45
44
  klass.instance_variable_set(:@token, token)
46
45
  klass.instance_variable_set(:@uri_prefix, uri_prefix)
47
46
  klass
@@ -25,7 +25,7 @@ module IqRdf
25
25
  objects = args
26
26
  predicate = IqRdf::Predicate.new(@predicate_namespace, postfix, @subject, options[:lang])
27
27
  if (block)
28
- raise ArgumentError, "A predicate may either have agruments or a block, or both." if objects.size > 0
28
+ raise ArgumentError, "A predicate may either have arguments or a block, or both." if objects.size > 0
29
29
  blank_node = IqRdf::BlankNode.new
30
30
  yield blank_node
31
31
  predicate << blank_node
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module IqRdf
16
- VERSION = "0.1.10"
16
+ VERSION = "0.1.12"
17
17
  end
@@ -39,7 +39,7 @@ class IqRdfTest < Test::Unit::TestCase
39
39
  end
40
40
 
41
41
  def test_uri_definitions
42
- IqRdf::Document.new("http://default-namespace.com/").namespaces :innoq => 'http://www.innoq.com/'
42
+ IqRdf::Document.new("http://default-namespace.com/").namespaces :innoq => "http://www.innoq.com/"
43
43
 
44
44
  IqRdf::Innoq::tillsc
45
45
 
@@ -194,7 +194,7 @@ _:b2 <http://www.umweltprobenbank.de/title> "blubb"@de .
194
194
  assert_equal(<<rdf.strip, document.to_ntriples.strip)
195
195
  <http://www.test.de/testemann> <http://xmlns.com/foaf/0.1/knows> <http://www.test.de/testefrau> .
196
196
  <http://www.test.de/testemann> <http://xmlns.com/foaf/0.1/nick> "Testy"@de .
197
- <http://www.test.de/testemann> <http://xmlns.com/foaf/0.1/lastname> "T\\u00e4st\\u00e4mann" .
197
+ <http://www.test.de/testemann> <http://xmlns.com/foaf/0.1/lastname> "Tästämann" .
198
198
  <http://www.test.de/testemann> <http://www.test.de/age> "32"^^<http://www.w3.org/2001/XMLSchema#integer> .
199
199
  <http://www.test.de/testemann> <http://www.test.de/married> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .
200
200
  <http://www.test.de/testemann> <http://www.test.de/weight> "65.8"^^<http://www.w3.org/2001/XMLSchema#decimal> .
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iq_rdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
5
- prerelease:
4
+ version: 0.1.12
6
5
  platform: ruby
7
6
  authors:
8
7
  - Till Schulte-Coerne
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-23 00:00:00.000000000 Z
11
+ date: 2013-11-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: builder
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: activesupport
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: IqRdf - A builder like rdf library for ruby and rails
@@ -96,27 +89,26 @@ files:
96
89
  - test/xml_test.rb
97
90
  homepage: http://github.com/innoq/iq_rdf
98
91
  licenses: []
92
+ metadata: {}
99
93
  post_install_message:
100
94
  rdoc_options: []
101
95
  require_paths:
102
96
  - lib
103
97
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
98
  requirements:
106
- - - ! '>='
99
+ - - '>='
107
100
  - !ruby/object:Gem::Version
108
101
  version: '0'
109
102
  required_rubygems_version: !ruby/object:Gem::Requirement
110
- none: false
111
103
  requirements:
112
- - - ! '>='
104
+ - - '>='
113
105
  - !ruby/object:Gem::Version
114
106
  version: '0'
115
107
  requirements: []
116
108
  rubyforge_project:
117
- rubygems_version: 1.8.23
109
+ rubygems_version: 2.0.3
118
110
  signing_key:
119
- specification_version: 3
111
+ specification_version: 4
120
112
  summary: IqRdf - A builder like rdf library for ruby and rails
121
113
  test_files:
122
114
  - test/iq_rdf_test.rb