printr 0.1.3 → 0.1.4
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/lib/printr.rb +11 -1
- data/printr.gemspec +1 -1
- metadata +2 -2
data/lib/printr.rb
CHANGED
@@ -111,8 +111,14 @@ module Printr
|
|
111
111
|
end
|
112
112
|
def print_to(key,text)
|
113
113
|
key = key.to_sym
|
114
|
+
if text.nil? then
|
115
|
+
puts "[Printr] Umm...text is nil dudes..."
|
116
|
+
return
|
117
|
+
end
|
114
118
|
begin
|
115
119
|
text = sanitize(text)
|
120
|
+
if text.nil? then
|
121
|
+
puts "[Printr] Sanitize nillified the text..."
|
116
122
|
t = Printr.printrs[key].class
|
117
123
|
if Printr.printrs[key].class == File then
|
118
124
|
Printr.printrs[key].write text
|
@@ -143,7 +149,7 @@ module Printr
|
|
143
149
|
text.gsub!(Printr.sanitize_tokens[i],Printr.sanitize_tokens[i+1])
|
144
150
|
i += 2
|
145
151
|
end while i < Printr.sanitize_tokens.length
|
146
|
-
text
|
152
|
+
return text
|
147
153
|
end
|
148
154
|
def template(name,bndng)
|
149
155
|
puts "[Printr] attempting to print with template #{RAILS_ROOT}/app/views/printr/#{name}.prnt.erb"
|
@@ -151,9 +157,13 @@ module Printr
|
|
151
157
|
erb = ERB.new(File.new("#{RAILS_ROOT}/app/views/printr/#{name}.prnt.erb",'r').read)
|
152
158
|
rescue Exception => e
|
153
159
|
puts "[Printr] Exception in view: " + e.inspect
|
160
|
+
|
154
161
|
end
|
155
162
|
puts "[Printr] returning text"
|
156
163
|
text = erb.result(bndng)
|
164
|
+
if text.nil? then
|
165
|
+
text = 'erb result made me nil'
|
166
|
+
end
|
157
167
|
return text
|
158
168
|
end
|
159
169
|
end
|
data/printr.gemspec
CHANGED