show_in_browser 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of show_in_browser might be problematic. Click here for more details.
- data/lib/show_in_browser.rb +7 -15
- metadata +1 -1
data/lib/show_in_browser.rb
CHANGED
@@ -1,23 +1,15 @@
|
|
1
1
|
class ShowInBrowser
|
2
|
+
FILE_LOCATION = "/tmp/browser.html"
|
3
|
+
|
2
4
|
class << self
|
3
5
|
|
4
6
|
def show(html)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
echo "#{html}" >> $f
|
9
|
-
open $f
|
10
|
-
`
|
11
|
-
puts escaped_html
|
12
|
-
end
|
13
|
-
|
14
|
-
def shell_escape(str)
|
15
|
-
return "''" if str.empty?
|
7
|
+
file = File.open(FILE_LOCATION, 'w')
|
8
|
+
file.write(html)
|
9
|
+
file.close
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
str.gsub!(/\n/, "'\n'")
|
20
|
-
return str
|
11
|
+
`open #{FILE_LOCATION}`
|
12
|
+
puts html
|
21
13
|
end
|
22
14
|
|
23
15
|
end
|