string-mapper 0.1.2 → 0.1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,7 @@
1
- == 0.1.2 2009-10-27
1
+ == 0.1.2.1 2009-11-23
2
+ * Bugfix in conversions from String or Symbol (too much opened Regex)
3
+
4
+ == 0.1.2 2009-11-20
2
5
  * 1 behaviour changed:
3
6
  * Map of Regexp with captures to a Proc that receive them as an params. For
4
7
  example:
@@ -30,7 +30,7 @@ module StringMapper #:nodoc:
30
30
  MAJOR = 0
31
31
  MINOR = 1
32
32
  TINY = 2
33
- PATCH = nil # Set to nil for official release
33
+ PATCH = 1 # Set to nil for official release
34
34
 
35
35
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
36
36
  end
@@ -47,7 +47,7 @@ class String
47
47
  regexp = if key.is_a?(Regexp)
48
48
  key
49
49
  else
50
- Regexp.new(key.to_s, Regexp::IGNORECASE)
50
+ Regexp.new("^#{key}$", Regexp::IGNORECASE)
51
51
  end
52
52
  if self =~ regexp
53
53
  mapping = if value.is_a?(String)
@@ -27,11 +27,15 @@ describe "String.add_mapper(:target)" do
27
27
 
28
28
  it 'should convert from a String ignoring case' do
29
29
  String.target_mappings['one million'] = 1000000
30
+ 'Thirty or one million'.to_target.should be_nil
31
+ 'one million dollars'.to_target.should be_nil
30
32
  'One million'.to_target.should be(1000000)
31
33
  end
32
34
 
33
35
  it 'should convert from a Symbol ignoring case' do
34
36
  String.target_mappings[:four] = 4
37
+ 'Twenty four'.to_target.should be_nil
38
+ 'fourty five'.to_target.should be_nil
35
39
  'FOUR'.to_target.should be(4)
36
40
  end
37
41
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{string-mapper}
5
- s.version = "0.1.2"
5
+ s.version = "0.1.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Fernando Garc\303\255a Samblas"]
9
- s.date = %q{2009-11-20}
9
+ s.date = %q{2009-11-23}
10
10
  s.description = %q{}
11
11
  s.email = ["fernando.garcia@the-cocktail.com"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string-mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Fernando Garc\xC3\xADa Samblas"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-20 00:00:00 +01:00
12
+ date: 2009-11-23 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency