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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 198aee0dbd9458b89f2b3f0a18e0473bd058ac3f
4
- data.tar.gz: 62e51d0200e8ac82ada1e4c3a93bd2449a7aca15
3
+ metadata.gz: 66f96d8c1e8785c87bee9c48e787b7b664c5ad37
4
+ data.tar.gz: 186787e2a523d468c44b90cfa9bad0f7cd413851
5
5
  SHA512:
6
- metadata.gz: e3819155b979530ae7858722b3ab46e27715358a316654356c99a2f6fc22ee4b6605645fef44c4d637b2397eafd76d5480467176d6cd23d338939fbd39f19215
7
- data.tar.gz: 17da90b44683b519f69594cf975941a53e6f555b8abd34754496ed480a2d29af79eafbf417f104b58f0d789326574dca34d954fb24c77516a9ebe0da89bc2976
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
@@ -1,3 +1,3 @@
1
1
  module PragmaticContext
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pragmatic_context
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mat Trudel