musterb 0.0.2 → 0.0.3

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.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Musterb
2
2
 
3
- TODO: Write a gem description
3
+ This is a gem that lets you compile mustache to erb so that rails will do all the nice caching and such that it does for ERB.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,12 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ Add this into config/initializers/musterb_handler.rb
22
+ ```ruby
23
+ require 'musterb/template_handler'
24
+
25
+ ActionView::Template.register_template_handler :mustache, Musterb::TemplateHandler
26
+ ```
22
27
 
23
28
  ## Contributing
24
29
 
@@ -4,12 +4,8 @@ class Musterb::BindingExtractor
4
4
  end
5
5
 
6
6
  def [](symbol)
7
- @binding.eval <<-EOF
8
- begin
9
- #{symbol}
10
- rescue NameError
11
- nil
12
- end
13
- EOF
7
+ @binding.eval symbol
8
+ rescue NameError
9
+ nil
14
10
  end
15
- end
11
+ end
@@ -0,0 +1,9 @@
1
+ require 'musterb'
2
+
3
+ module Musterb::TemplateHandler
4
+ def self.call(template)
5
+ erb = Musterb.to_erb(template.source)
6
+ klass = ActionView::Template::Handlers::ERB
7
+ klass.erb_implementation.new(erb, :trim => (klass.erb_trim_mode == "-")).src
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Musterb
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: musterb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -93,6 +93,8 @@ files:
93
93
  bGliL211c3RlcmIvbnVsbF9leHRyYWN0b3IucmI=
94
94
  - !binary |-
95
95
  bGliL211c3RlcmIvb2JqZWN0X2V4dHJhY3Rvci5yYg==
96
+ - !binary |-
97
+ bGliL211c3RlcmIvdGVtcGxhdGVfaGFuZGxlci5yYg==
96
98
  - !binary |-
97
99
  bGliL211c3RlcmIvdmVyc2lvbi5yYg==
98
100
  - !binary |-