mwmitchell-rsolr-ext 0.5.4 → 0.5.5

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.
@@ -20,6 +20,7 @@ class RSolr::Ext::HashMethodizer
20
20
  def methodize!(h)
21
21
  h.keys.each do |k|
22
22
  meth = snake_case(k)
23
+ meth = meth.gsub(/[^_a-z]/i, '_').gsub(/^_+/i, '')
23
24
  val_key = case k
24
25
  when String
25
26
  "'#{k}'"
data/lib/rsolr-ext.rb CHANGED
@@ -15,7 +15,7 @@ module RSolr
15
15
 
16
16
  module Ext
17
17
 
18
- VERSION = '0.5.4'
18
+ VERSION = '0.5.5'
19
19
 
20
20
  autoload :Request, 'rsolr-ext/request.rb'
21
21
  autoload :Response, 'rsolr-ext/response.rb'
data/rsolr-ext.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rsolr-ext"
3
- s.version = "0.5.4"
3
+ s.version = "0.5.5"
4
4
  s.date = "2009-03-17"
5
5
  s.summary = "An extension lib for RSolr"
6
6
  s.email = "goodieboy@gmail.com"
@@ -4,7 +4,7 @@ require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr-ext')
4
4
  class RSolrExtRequestTest < Test::Unit::TestCase
5
5
 
6
6
  def testable_hash
7
- {:name=>'Sam', :age=>90, :kids=>['Fred', 'Betty'], :favorites=>{:red=>1, :blue=>9}}
7
+ {';key-with-invalid-method-chars'=>1, :name=>'Sam', :age=>90, :kids=>['Fred', 'Betty'], :favorites=>{:red=>1, :blue=>9}}
8
8
  end
9
9
 
10
10
  test 'the default behavior of a hash, after methodize!' do
@@ -28,6 +28,8 @@ class RSolrExtRequestTest < Test::Unit::TestCase
28
28
 
29
29
  # make sure that the difference in method size is the size of the keys in my_hash
30
30
  assert_equal my_hash.methods.size - key_count, original_methods.size
31
+
32
+ assert my_hash.respond_to?(:key_with_invalid_method_chars)
31
33
  end
32
34
 
33
35
  test 'the method accessors on a modified hash' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mwmitchell-rsolr-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Mitchell