primedia-endeca 0.9.20 → 0.9.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/endeca.gemspec +1 -1
- data/lib/endeca/map.rb +9 -4
- data/lib/endeca.rb +1 -1
- data/spec/endeca/document_spec.rb +7 -4
- metadata +1 -1
data/endeca.gemspec
CHANGED
data/lib/endeca/map.rb
CHANGED
@@ -20,15 +20,20 @@ module Endeca
|
|
20
20
|
# join characters (can be overridden by specifying +with+ and/or +join+).
|
21
21
|
#
|
22
22
|
# Example:
|
23
|
-
# map(:city => :propertycity).
|
23
|
+
# map(:city => :propertycity).into(:ntk => :ntt)
|
24
24
|
#
|
25
25
|
# Document.all(:city => 'Atlanta') =>
|
26
26
|
# ?ntk=propercity&ntt=>Atlanta
|
27
27
|
def into(hash)
|
28
|
+
hash = hash.intern if hash.respond_to?(:intern)
|
29
|
+
if hash.is_a?(Hash)
|
30
|
+
raise ArgumentError, "Only one key/value pair allowed" if hash.size > 1
|
31
|
+
hash = hash.to_a.flatten
|
32
|
+
hash = {hash.first.to_sym => hash.last.to_sym}
|
33
|
+
end
|
28
34
|
@into = hash
|
29
|
-
|
30
|
-
|
31
|
-
@join ||= '|'
|
35
|
+
with ':'
|
36
|
+
join '|'
|
32
37
|
self
|
33
38
|
end
|
34
39
|
|
data/lib/endeca.rb
CHANGED
@@ -253,11 +253,14 @@ describe Endeca::Document do
|
|
253
253
|
describe "with multiple keys that are joined" do
|
254
254
|
it "should include all the keys" do
|
255
255
|
require 'pp'
|
256
|
-
Endeca::Document.map(:apartments => :showapartments).into('
|
257
|
-
Endeca::Document.map(:colleges => :showcolleges).into('
|
256
|
+
Endeca::Document.map(:apartments => :showapartments).into('Ntk' => 'Ntt')
|
257
|
+
Endeca::Document.map(:colleges => :showcolleges).into('Ntk' => 'Ntt')
|
258
|
+
ntk = Endeca::Document.transform_query_options('apartments' => '1', 'colleges' => '2')[:Ntk]
|
259
|
+
ntk.should include('showapartments')
|
260
|
+
ntk.should include('showcolleges')
|
258
261
|
ntt = Endeca::Document.transform_query_options('apartments' => '1', 'colleges' => '2')[:Ntt]
|
259
|
-
ntt.should include('
|
260
|
-
ntt.should include('
|
262
|
+
ntt.should include('1')
|
263
|
+
ntt.should include('2')
|
261
264
|
end
|
262
265
|
end
|
263
266
|
|