dns_guru 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -23,7 +23,7 @@ PKG_FILES = FileList[
23
23
 
24
24
  spec = Gem::Specification.new do |s|
25
25
  s.name = "dns_guru"
26
- s.version = "0.1.2"
26
+ s.version = "0.1.3"
27
27
  s.author = "Dns Guru"
28
28
  s.email = "ken.miller@gmail.com"
29
29
  s.homepage = "http://github.com/kemiller/dns_guru"
@@ -20,7 +20,12 @@ module DnsGuru
20
20
  end
21
21
 
22
22
  def rewrite(string, options = {})
23
- generate(match(string).merge(options))
23
+ params = match(string)
24
+ if params
25
+ generate(match(string).merge(options))
26
+ else
27
+ string
28
+ end
24
29
  end
25
30
 
26
31
  def pattern(pattern_string, params = {})
@@ -32,16 +32,16 @@ module DnsGuru
32
32
 
33
33
  def test_generate_no_hit
34
34
  hash = { :str => "mygenerate_here" }
35
- generateer = Matcher.new([m1 = MockPattern.new, m2 = MockPattern.new])
36
- generateer.generate(hash)
35
+ matcher = Matcher.new([m1 = MockPattern.new, m2 = MockPattern.new])
36
+ matcher.generate(hash)
37
37
  assert_equal hash, m1.got_generate, "First Pattern wasn't checked"
38
38
  assert_equal hash, m2.got_generate, "Second Pattern wasn't checked"
39
39
  end
40
40
 
41
41
  def test_generate_hit
42
42
  hash = { :str => "mygenerate_here" }
43
- generateer = Matcher.new([m1 = MockPattern.new(true), m2 = MockPattern.new])
44
- generateer.generate(hash)
43
+ matcher = Matcher.new([m1 = MockPattern.new(true), m2 = MockPattern.new])
44
+ matcher.generate(hash)
45
45
  assert_equal hash, m1.got_generate, "First Pattern wasn't checked"
46
46
  assert_equal nil, m2.got_generate, "Second Pattern should not have been checked"
47
47
  end
@@ -70,6 +70,11 @@ module DnsGuru
70
70
  assert_equal "www.mmp.com", matcher.generate
71
71
  end
72
72
 
73
+ def test_rewrite_no_hit
74
+ matcher = Matcher.new
75
+ assert_equal "asdfasdf", matcher.rewrite("asdfasdf",:anything => :else)
76
+ end
77
+
73
78
  end
74
79
 
75
80
  class MockPattern
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dns_guru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dns Guru
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-07 00:00:00 -08:00
12
+ date: 2010-03-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15