show_in_browser 0.0.2 → 0.0.3

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.

Potentially problematic release.


This version of show_in_browser might be problematic. Click here for more details.

Files changed (2) hide show
  1. data/lib/show_in_browser.rb +7 -15
  2. metadata +1 -1
@@ -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
- escaped_html = shell_escape(html)
6
- `f="/tmp/browser.html"
7
- rm $f
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
- str = str.dup
18
- str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/n, "\\\\\\1")
19
- str.gsub!(/\n/, "'\n'")
20
- return str
11
+ `open #{FILE_LOCATION}`
12
+ puts html
21
13
  end
22
14
 
23
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: show_in_browser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: