pragmatic_context 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/pragmatic_context/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66f96d8c1e8785c87bee9c48e787b7b664c5ad37
|
4
|
+
data.tar.gz: 186787e2a523d468c44b90cfa9bad0f7cd413851
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0dfd00acc56403a5b9c55cb2f3d1b800b2fd7b59d3506045584222d4a28479a666faa06f81e0b1c053786c98fecf41055d92ced15bae6372ed030e4baea31fe
|
7
|
+
data.tar.gz: 3eb4e5a98bfce4d5e7c938fa85c789375856372155d6f01ea34777b7101a07fbed12446a44b31d8f155f632b58cac4edb55915f965f9cc089dae94b65cd79bed
|
data/README.md
CHANGED
@@ -112,6 +112,7 @@ it like so:
|
|
112
112
|
field :email
|
113
113
|
|
114
114
|
contextualize_as_type 'https://schema.org/Person'
|
115
|
+
contextualize_with_id { |person| Rails.application.routes.url_helpers.person_url(person) }
|
115
116
|
|
116
117
|
contextualize :first_name, :as => 'http://schema.org/givenName'
|
117
118
|
contextualize :last_name, :as => 'http://schema.org/familyName'
|
@@ -135,6 +136,7 @@ the `Person` object described above will produce the following JSON-LD document:
|
|
135
136
|
"email": { "@id", "http://schema.org/email" },
|
136
137
|
},
|
137
138
|
"@type": "http://schema.org/Person",
|
139
|
+
"@id": "http://example.com/people/123",
|
138
140
|
"first_name": "Mat",
|
139
141
|
"last_name": "Trudel",
|
140
142
|
"email": "mat@geeky.net"
|
@@ -150,6 +152,9 @@ A couple of things to note about this implementation:
|
|
150
152
|
* If a type is given for the contextualized class (via the
|
151
153
|
`contextualize_as_type` statement), it will have a matching `@type` field in
|
152
154
|
its JSON-LD representation.
|
155
|
+
* If an ID factory is given for the contextualized class (via the
|
156
|
+
`contextualize_with_id` statement), it will have a matching `@id` field in
|
157
|
+
its JSON-LD representation.
|
153
158
|
* For each field present in your object's `as_json` method *that has a matching
|
154
159
|
`contextualize` statement*, `as_jsonld` will:
|
155
160
|
* If the field is a primitive value (string, number, boolean, nil), its
|