pragmatic_context 0.1.5 → 0.1.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 191d4887d09b2330efbf16319aeaf13e783b1cc1
|
4
|
+
data.tar.gz: a6b30ec774cbf842dc8ea4ecbe92117dd2ee7f52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23459433be74ab19a0cdeab7213cf514618ae6ba17358481789e810317fa33055d1d1fd8f3d7c989f9245845875552af114696ff27f4c7767dcb037a94de4a97
|
7
|
+
data.tar.gz: 22a92856d956c08d015149586ae0f30ce6df1e3ebd7ddf49c8d7df89838e26832585c2cdd38c4754689a5115bdb76828390bfd53aa9c5fff923286592635e33c
|
@@ -8,8 +8,10 @@ module PragmaticContext
|
|
8
8
|
@properties[term] = ActiveSupport::HashWithIndifferentAccess.new params
|
9
9
|
end
|
10
10
|
|
11
|
-
def definitions_for_terms(terms)
|
12
|
-
Hash[@properties.
|
11
|
+
def definitions_for_terms(terms = nil)
|
12
|
+
definitions = Hash[@properties.map { |term, params| [term, definition_from_params(params)] }]
|
13
|
+
definitions.slice(terms) if terms
|
14
|
+
definitions
|
13
15
|
end
|
14
16
|
|
15
17
|
private
|
@@ -10,5 +10,14 @@ describe PragmaticContext::DefaultContextualizer do
|
|
10
10
|
"ham" => "http://ham.com"
|
11
11
|
})
|
12
12
|
end
|
13
|
+
|
14
|
+
it 'should return all terms when asked' do
|
15
|
+
subject.add_term('bacon', :as => 'http://bacon.com', :type => 'number')
|
16
|
+
subject.add_term('ham', :as => 'http://ham.com')
|
17
|
+
subject.definitions_for_terms.should eq({
|
18
|
+
"bacon" => { "@id" => "http://bacon.com", "@type" => "number" },
|
19
|
+
"ham" => "http://ham.com"
|
20
|
+
})
|
21
|
+
end
|
13
22
|
end
|
14
23
|
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.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Trudel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|