pragmatic_context 0.1.3 → 0.1.4

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: a60bf7a2275e2574efef334b737bd33f8f906257
4
- data.tar.gz: 7af80e83673d61cfa2878280783ac29fd0be7bf5
3
+ metadata.gz: c352301219972a3d0b5ede9d37a007b2e7a22e53
4
+ data.tar.gz: 3bf10c2fc0b49085b3bed5bd548500ed4cff75ee
5
5
  SHA512:
6
- metadata.gz: 00e267df94129526296bd61a1e810b45c87c29e71121f95deb93272a8203ebfade3f94750746f4eaace246ba0afdb2d450bc6ace4f65421471c472468f414fd5
7
- data.tar.gz: fb7bbae5beda4427d6ca15551ce7aa01a3782e21e03dc3bdf992d3f50aebc29e6c2d61eb01b2c862657f111d114acb87ddea6f46450a45e18dad97f3823249ff
6
+ metadata.gz: 80dc5647ef9ed86d8461e6fedd69358ffff62f63be17326f295d10e79b5f9dfe4162a2e0dd0f04b621e7a68ee7c6112e9c0ac299597a0c1683b6a380f4c8a52d
7
+ data.tar.gz: 06ed957154e5c9be3f5dd231284178dc931d392064977dbba4b2a55eab298e0fe79283a7770f3368403692646c37373af8d0917627b526a4662f48149e58e2c5
data/README.md CHANGED
@@ -10,7 +10,7 @@ I'm glad you asked. [JSON-LD](http://json-ld.org/) is a lightweight JSON format
10
10
  for expressing data within a context (also known as 'Linked Data'). Essentially
11
11
  what this means is that it lets you say that the thing your data model calls
12
12
  a 'last_name' (and what someone else may call 'family_name', or 'surname', or 'apellido') are all embodiments of the same abstract idea of a [Family
13
- Name](http://xmlns.com/foaf/spec/#term_familyName). JSON-LD is similar in spirit
13
+ Name](http://schema.org/familyName). JSON-LD is similar in spirit
14
14
  (though [vastly different in
15
15
  execution](http://manu.sporny.org/2014/json-ld-origins-2/)) to
16
16
  [RDF](http://en.wikipedia.org/wiki/Resource_Description_Framework). It allows
@@ -51,7 +51,7 @@ identify a field as representing the concept of a person's first
51
51
  name, whether the field was named 'first_name', 'FirstName', 'given_name', or
52
52
  even 'field1234'. By allowing you to contextualize your data, JSON-LD lets you
53
53
  essentially say "when I say 'last_name', I really mean
54
- `http://xmlns.com/foaf/0.1/familyName`". In so doing, it becomes possible to
54
+ `http://schema.org/familyName`". In so doing, it becomes possible to
55
55
  associate the last name fields of any JSON-LD API, regardless of what they name
56
56
  their fields.
57
57
 
@@ -15,10 +15,14 @@ module PragmaticContext
15
15
  private
16
16
 
17
17
  def definition_from_params(params)
18
- result = {}
19
- result['@id'] = params[:as] if params[:as]
20
- result['@type'] = params[:type] if params[:type]
21
- result
18
+ if params.keys == ['as']
19
+ params[:as]
20
+ else
21
+ result = {}
22
+ result['@id'] = params[:as] if params[:as]
23
+ result['@type'] = params[:type] if params[:type]
24
+ result
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -1,3 +1,3 @@
1
1
  module PragmaticContext
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -3,11 +3,11 @@ require 'pragmatic_context/default_contextualizer'
3
3
  describe PragmaticContext::DefaultContextualizer do
4
4
  describe 'adding terms' do
5
5
  it 'should add terms and be able to retrive them' do
6
- subject.add_term('bacon', :as => 'http://bacon.com')
6
+ subject.add_term('bacon', :as => 'http://bacon.com', :type => 'number')
7
7
  subject.add_term('ham', :as => 'http://ham.com')
8
8
  subject.definitions_for_terms(%w(bacon ham)).should eq({
9
- "bacon" => { "@id" => "http://bacon.com" },
10
- "ham" => { "@id" => "http://ham.com" }
9
+ "bacon" => { "@id" => "http://bacon.com", "@type" => "number" },
10
+ "ham" => "http://ham.com"
11
11
  })
12
12
  end
13
13
  end
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.3
4
+ version: 0.1.4
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-07-02 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler