primedia-endeca 0.9.20 → 0.9.21

Sign up to get free protection for your applications and to get access to all the features.
data/endeca.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{endeca}
3
- s.version = "0.9.20"
3
+ s.version = "0.9.21"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Rein Henrichs", "Andy Stone"]
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).in(:ntk => ntt)
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
- @into = @into.symbolize_keys if @into.respond_to?(:symbolize_keys)
30
- @with ||= ':'
31
- @join ||= '|'
35
+ with ':'
36
+ join '|'
32
37
  self
33
38
  end
34
39
 
data/lib/endeca.rb CHANGED
@@ -21,7 +21,7 @@ require 'endeca/document'
21
21
  module Endeca
22
22
 
23
23
  # :stopdoc:
24
- VERSION = '0.9.20'
24
+ VERSION = '0.9.21'
25
25
  # :startdoc:
26
26
 
27
27
  # Returns the version string for the library.
@@ -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('Ntt' => 'Ntk')
257
- Endeca::Document.map(:colleges => :showcolleges).into('Ntt' => 'Ntk')
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('showapartments')
260
- ntt.should include('showcolleges')
262
+ ntt.should include('1')
263
+ ntt.should include('2')
261
264
  end
262
265
  end
263
266
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: primedia-endeca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.20
4
+ version: 0.9.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rein Henrichs