erubis_for_rails23 0.1 → 0.1.1
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 +2 -0
- data/erubis_for_rails23.gemspec +1 -1
- data/lib/erubis_for_rails23.rb +16 -12
- metadata +2 -1
data/README.md
CHANGED
data/erubis_for_rails23.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |spec|
|
|
2
2
|
spec.name = 'erubis_for_rails23'
|
|
3
|
-
spec.version = '0.1'
|
|
3
|
+
spec.version = '0.1.1'
|
|
4
4
|
spec.authors = ['Bachue Zhou']
|
|
5
5
|
spec.email = ['bachue.shu@gmail.com']
|
|
6
6
|
spec.description = %q{A simple gem which can resolve some compatibility issues when using Erubis in Rails 2.3}
|
data/lib/erubis_for_rails23.rb
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
require 'erubis'
|
|
2
2
|
require 'erb'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
ERB_ENGINE = Erubis::Eruby unless defined?(ERB_ENGINE)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ERB::Util = util
|
|
6
|
+
if ERB_ENGINE != ERB
|
|
7
|
+
util = ERB::Util
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
Object.send :remove_const, :ERB
|
|
10
|
+
ERB = ERB_ENGINE
|
|
11
|
+
ERB::Util = util
|
|
12
|
+
|
|
13
|
+
class Erubis::Eruby # to be compatible with ERB constructor
|
|
14
|
+
def initialize(input = nil, *args)
|
|
15
|
+
if args.size.zero? || args.first.is_a?(Hash)
|
|
16
|
+
super
|
|
17
|
+
else
|
|
18
|
+
trim = args[1] == '-'
|
|
19
|
+
bufvar = args[2]
|
|
20
|
+
super input, :trim => trim, :bufvar => bufvar
|
|
21
|
+
end
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
end
|