Sha256: 045f821861e39e604aae5be87ea04abd13d31f35cff00a728b85ab814c46683a

Contents?: true

Size: 698 Bytes

Versions: 4

Compression:

Stored size: 698 Bytes

Contents

module Vizres
  class Browser
    class << self
      
      def open(url)
        if macos?
          system("open #{url}")
        elsif windows?
          system("'C:\Program Files\Internet Explorer\IEXPLORE.EXE' #{url}")
        elsif linux?
          system("kfmclient openURL #{url}")
        else
          raise "Unrecognized OS. Browser can't be found."
        end
      end
      
      def host
        require 'rbconfig'
        Config::CONFIG['host']
      end
      
      def macos?
        host.include?('darwin')
      end
      
      def windows?
        host.include?('mswin')
      end
      
      def linux?
        host.include?('linux')
      end
      
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
pelargir-vizres-0.5 lib/vizres/browser.rb
radiant-0.7.2 vendor/plugins/vizres/lib/vizres/browser.rb
radiant-0.7.0 vendor/plugins/vizres/lib/vizres/browser.rb
radiant-0.7.1 vendor/plugins/vizres/lib/vizres/browser.rb