pragmatic_context 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2ec6ccfc5c04da2f9decfe359fde2b08a056d84
|
4
|
+
data.tar.gz: 7497e0289cc5c38616f91ce6a2d6adcd8ee1eb31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bbe3d6badf4a09768da5ce2ae9d9cedf2e5c4a897904ef029535e980c1f9189bd9b7076578462998ec7994155097de7266fa02dcb3512e724733f481595e441
|
7
|
+
data.tar.gz: d4c27b700f9f4c88e3a66e6cd830dc878fdf4f61a9e103e8dac65905685f54d4bb211c7f1b0c9c61ba8eb87ce09132acecae3d93f753af17bf329e7c8bdf2470
|
data/README.md
CHANGED
@@ -198,7 +198,7 @@ values, and for the resulting document to serialize out as something like:
|
|
198
198
|
If you want to refer to your JSON-LD context by URI (see Example 4 in the [JSON
|
199
199
|
spec](http://www.w3.org/TR/json-ld) for more info), or if you want to use your
|
200
200
|
own serializer to customize the JSON-LD representaions you produce, you'll want
|
201
|
-
to make use of the `Contextualizable` mixin's `
|
201
|
+
to make use of the `Contextualizable` mixin's `jsonld_context` method. `jsonld_context`
|
202
202
|
returns a Hash object ready to be serialized into the `@context` field of the
|
203
203
|
output object. By wiring this up in whatever serializer your application uses,
|
204
204
|
you can easily extend custom serializations to output
|
@@ -49,10 +49,10 @@ module PragmaticContext
|
|
49
49
|
results[term] = json_results[term]
|
50
50
|
end
|
51
51
|
end
|
52
|
-
results.merge("@context" =>
|
52
|
+
results.merge("@context" => jsonld_context)
|
53
53
|
end
|
54
54
|
|
55
|
-
def
|
55
|
+
def jsonld_context
|
56
56
|
self.class.contextualizer.definitions_for_terms(terms)
|
57
57
|
end
|
58
58
|
|
@@ -63,7 +63,7 @@ describe PragmaticContext::Contextualizable do
|
|
63
63
|
end
|
64
64
|
subject.bacon = 'crispy'
|
65
65
|
subject.ham = 'honey'
|
66
|
-
subject.as_jsonld.should == { "bacon" => "crispy", "@context" => subject.
|
66
|
+
subject.as_jsonld.should == { "bacon" => "crispy", "@context" => subject.jsonld_context }
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should recurse into Contextualizable subobjects' do
|
@@ -76,10 +76,10 @@ describe PragmaticContext::Contextualizable do
|
|
76
76
|
subject.ham.bacon = 'nested bacon'
|
77
77
|
subject.ham.ham = 'nested ham'
|
78
78
|
subject.as_jsonld.should == {
|
79
|
-
"@context" => subject.
|
79
|
+
"@context" => subject.jsonld_context,
|
80
80
|
"bacon" => "crispy",
|
81
81
|
"ham" => {
|
82
|
-
"@context" => subject.ham.
|
82
|
+
"@context" => subject.ham.jsonld_context,
|
83
83
|
"bacon" => "nested bacon",
|
84
84
|
"ham" => "nested ham"
|
85
85
|
}
|
@@ -94,7 +94,7 @@ describe PragmaticContext::Contextualizable do
|
|
94
94
|
subject.bacon = 'crispy'
|
95
95
|
subject.ham = { 'bacon' => 'nested bacon' }
|
96
96
|
subject.as_jsonld.should == {
|
97
|
-
"@context" => subject.
|
97
|
+
"@context" => subject.jsonld_context,
|
98
98
|
"bacon" => "crispy",
|
99
99
|
"ham:bacon" => "nested bacon"
|
100
100
|
}
|
@@ -108,8 +108,8 @@ describe PragmaticContext::Contextualizable do
|
|
108
108
|
end
|
109
109
|
subject.bacon = 'crispy'
|
110
110
|
subject.ham = 'honey'
|
111
|
-
subject.
|
112
|
-
subject.
|
111
|
+
subject.jsonld_context['bacon']['@id'].should == 'http://bacon.yum'
|
112
|
+
subject.jsonld_context['ham'].should == nil
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pragmatic_context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Trudel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -142,3 +142,4 @@ summary: JSON-LD from a JSON perspective
|
|
142
142
|
test_files:
|
143
143
|
- spec/lib/pragmatic_context/contextualizable_spec.rb
|
144
144
|
- spec/lib/pragmatic_context/default_contextualizer_spec.rb
|
145
|
+
has_rdoc:
|