Module: Rickroll
- Defined in:
- lib/rickroll.rb,
lib/rickroll/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
- .has_open? ⇒ Boolean
- .open ⇒ Object
- .open_with_launchy ⇒ Object
- .open_with_safari ⇒ Object
- .path ⇒ Object
Class Method Details
.has_open? ⇒ Boolean
14 15 16 17 18 |
# File 'lib/rickroll.rb', line 14 def self.has_open? `which open` return false unless $?.success? `open --help 2>&1`.include? 'Opens with the specified application' end |
.open ⇒ Object
19 20 21 |
# File 'lib/rickroll.rb', line 19 def self.open has_open? ? open_with_safari : open_with_launchy end |
.open_with_launchy ⇒ Object
7 8 9 10 |
# File 'lib/rickroll.rb', line 7 def self.open_with_launchy require 'launchy' Launchy.open(path) end |
.open_with_safari ⇒ Object
11 12 13 |
# File 'lib/rickroll.rb', line 11 def self.open_with_safari `open -a Safari #{path.inspect}` end |
.path ⇒ Object
4 5 6 |
# File 'lib/rickroll.rb', line 4 def self.path File.('../../site/index.html', __FILE__) end |