printr 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/printr/version.rb +1 -1
- data/lib/printr.rb +15 -0
- data/printr.gemspec +1 -1
- metadata +2 -2
data/lib/printr/version.rb
CHANGED
data/lib/printr.rb
CHANGED
@@ -178,6 +178,20 @@ module Printr
|
|
178
178
|
return text
|
179
179
|
end
|
180
180
|
|
181
|
+
def sane_template(name,bndng)
|
182
|
+
Printr.log "[Printr] attempting to print with template #{RAILS_ROOT}/app/views/#{Printr.scope}/#{name}.prnt.erb"
|
183
|
+
begin
|
184
|
+
erb = ERB.new(File.new("#{RAILS_ROOT}/app/views/#{Printr.scope}/#{name}.prnt.erb",'r').read,0,'>')
|
185
|
+
rescue Exception => e
|
186
|
+
Printr.log "[Printr] Exception in view: " + $!.inspect
|
187
|
+
end
|
188
|
+
Printr.log "[Printr] returning text"
|
189
|
+
text = erb.result(bndng)
|
190
|
+
if text.nil? then
|
191
|
+
text = 'erb result made me nil'
|
192
|
+
end
|
193
|
+
return sanitize(text)
|
194
|
+
end
|
181
195
|
def template(name,bndng)
|
182
196
|
Printr.log "[Printr] attempting to print with template #{RAILS_ROOT}/app/views/#{Printr.scope}/#{name}.prnt.erb"
|
183
197
|
begin
|
@@ -192,5 +206,6 @@ module Printr
|
|
192
206
|
end
|
193
207
|
return text
|
194
208
|
end
|
209
|
+
|
195
210
|
end
|
196
211
|
end
|
data/printr.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: printr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-01-18 00:00:00.000000000Z
|
14
14
|
dependencies: []
|
15
15
|
description: This engine allows you to define printers and templates.
|
16
16
|
email:
|