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: 88a0b60c96eb500404496ea8345b60e3918fe061
4
- data.tar.gz: 2a48a6692c6b7858c3643be1321b048f5d45452b
3
+ metadata.gz: 191d4887d09b2330efbf16319aeaf13e783b1cc1
4
+ data.tar.gz: a6b30ec774cbf842dc8ea4ecbe92117dd2ee7f52
5
5
  SHA512:
6
- metadata.gz: 83308f03bc29e1fb0fd0ca5ddbd345b04481e425bd3290e8bdaa730e4918a0f99f4564cd2de6a231200fed23a414ac49cdf67dac789ea20d297a3bb2da6e2e62
7
- data.tar.gz: fbb646247db59280a8060aea232186a24188fea46d3d283de8659621cdcf675d37a7e90f35167b0c2ccee28bed9332c261d296c420e5e332a2edd289d7a19e3b
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.slice(*terms).map { |term, params| [term, definition_from_params(params)] }]
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
@@ -1,3 +1,3 @@
1
1
  module PragmaticContext
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -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.5
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-07 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler