printr 0.4.0 → 0.5.0

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.
@@ -1,3 +1,3 @@
1
1
  module Printr
2
- VERSION = "0.0.2"
2
+ VERSION = "0.5.0"
3
3
  end
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
@@ -4,7 +4,7 @@ require "printr/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "printr"
7
- s.version = '0.4.0'
7
+ s.version = '0.5.0'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Michael Franzl","Jason Martin"]
10
10
  s.email = ["jason@jason-knight-martin.com"]
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.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: 2011-10-20 00:00:00.000000000Z
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: