module Forward

Constants

SUPPORT_EMAIL
VERSION

Public Class Methods

client_string() click to toggle source

Returns a string representing a detailed client version

Returns a String representing the client

# File lib/forward.rb, line 118
def self.client_string
  os     = RbConfig::CONFIG['host_os']
  engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'

  # TODO: make os version more friendly
  "(#{engine}-#{RUBY_VERSION})(#{os})(v#{Forward::VERSION})"
end
debug!() click to toggle source

Helper method for setting the log level to debug

# File lib/forward.rb, line 89
def self.debug!
  logger.level = Logger::DEBUG
end
logger() click to toggle source

Getter for the logger

Returns the new or cached Logger instance

# File lib/forward.rb, line 103
def self.logger
  @logger ||= begin
    _logger           = Logger.new(STDOUT)
    _logger.level     = Logger::WARN
    _logger.formatter = proc do |severity, datetime, progname, msg|
      "#{severity} - [#{datetime.strftime('%H:%M:%S')}] #{msg}\n"
    end

    _logger
  end
end
logger=(logger) click to toggle source

Setter for the logger

Returns the new Logger instance

# File lib/forward.rb, line 96
def self.logger=(logger)
  @logger ||= logger
end
os() click to toggle source

Helper for determining the host OS

Returns simplified and symbolized host os name

# File lib/forward.rb, line 42
def self.os
  @os ||= begin
    case RbConfig::CONFIG['host_os']
    when /mswin|mingw|cygwin/
      :windows
    when /darwin/
      :osx
    when /linux|bsd/
      :unix
    else
      :unknown
    end
  end
end
quiet!() click to toggle source

Helper method for making forward quiet (silence most output)

# File lib/forward.rb, line 79
def self.quiet!
  @quiet = true
end
quiet?() click to toggle source

Helper method for making forward quiet (silence most output)

# File lib/forward.rb, line 84
def self.quiet?
  @quiet == true
end
tunnel() click to toggle source

Getter for the current Client

Returns a Forward::Client instance

# File lib/forward.rb, line 74
def self.tunnel
  @tunnel
end
tunnel=(tunnel) click to toggle source

Setter for the current Client

Returns the new Forawrd::Client instance

# File lib/forward.rb, line 67
def self.tunnel=(tunnel)
  @tunnel = tunnel
end
windows?() click to toggle source

Helper to determine if host OS is windows

Returns Boolean

# File lib/forward.rb, line 60
def self.windows?
  @windows ||= os == :windows
end