braai 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- braai (1.2.1)
4
+ braai (1.2.2)
5
5
  activesupport
6
6
 
7
7
  GEM
@@ -12,7 +12,7 @@ GEM
12
12
  multi_json (~> 1.0)
13
13
  diff-lcs (1.1.3)
14
14
  i18n (0.6.1)
15
- multi_json (1.4.0)
15
+ multi_json (1.5.0)
16
16
  rspec (2.11.0)
17
17
  rspec-core (~> 2.11.0)
18
18
  rspec-expectations (~> 2.11.0)
data/README.md CHANGED
@@ -99,3 +99,4 @@ res.should match("<h2>MARK</h2>")
99
99
 
100
100
  * Mark Bates
101
101
  * Kevin Incorvia
102
+ * Nick Plante
@@ -17,24 +17,32 @@ module Braai::Matchers
17
17
  end
18
18
 
19
19
  def reset!
20
- @matchers = {
21
- /({{\s*for (\w+) in (\w+)\s*}}(.+?){{\s*\/for\s*}})/im => ->(template, key, matches) {
22
- res = []
23
- template.attributes[matches[2]].each do |val|
24
- res << Braai::Context.new(matches[3], template.matchers, template.attributes.merge(matches[1] => val)).render
25
- end
26
- res.join("\n")
27
- },
28
- /({{\s*([\w]+)\.([\w]+)\s*}})/i => ->(template, key, matches) {
29
- attr = template.attributes[matches[1]]
30
- attr ? attr.send(matches[2]) : nil
31
- },
32
- /({{\s*([\w]+)\s*}})/i => ->(template, key, matches) {
33
- attr = template.attributes[matches.last]
34
- attr ? attr.to_s : nil
35
- }
20
+ @matchers = {}
21
+ set_defaults
22
+ end
23
+
24
+ def set_defaults
25
+ @matchers ||= {}
26
+
27
+ @matchers[/({{\s*for (\w+) in (\w+)\s*}}(.+?){{\s*\/for\s*}})/im] = ->(template, key, matches) {
28
+ res = []
29
+ template.attributes[matches[2]].each do |val|
30
+ res << Braai::Context.new(matches[3], template.matchers, template.attributes.merge(matches[1] => val)).render
31
+ end
32
+ res.join("\n")
33
+ }
34
+
35
+ @matchers[/({{\s*([\w]+)\.([\w]+)\s*}})/i] = ->(template, key, matches) {
36
+ attr = template.attributes[matches[1]]
37
+ attr ? attr.send(matches[2]) : nil
38
+ }
39
+
40
+ @matchers[/({{\s*([\w]+)\s*}})/i] = ->(template, key, matches) {
41
+ attr = template.attributes[matches.last]
42
+ attr ? attr.to_s : nil
36
43
  }
37
- return @matchers
44
+
45
+ @matchers
38
46
  end
39
47
 
40
- end
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Braai
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
@@ -41,7 +41,7 @@ describe Braai::Matchers do
41
41
  end
42
42
 
43
43
  describe 'reset!' do
44
-
44
+
45
45
  it "resets the matchers to their original state" do
46
46
  matchers.should have(3).matchers
47
47
  map("foo") {}
@@ -52,4 +52,16 @@ describe Braai::Matchers do
52
52
 
53
53
  end
54
54
 
55
- end
55
+ describe 'set_defaults' do
56
+
57
+ it "installs the three base matchers" do
58
+ clear!
59
+ map("foo") {}
60
+ matchers.should have(1).matchers
61
+ set_defaults
62
+ matchers.should have(4).matchers
63
+ end
64
+
65
+ end
66
+
67
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braai
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-03 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  requirements: []
74
74
  rubyforge_project:
75
- rubygems_version: 1.8.24
75
+ rubygems_version: 1.8.23
76
76
  signing_key:
77
77
  specification_version: 3
78
78
  summary: Fully extensible templating system.