class Eye::Controller

Public Instance Methods

set_opt_http(params = {}) click to toggle source
# File lib/eye-http/extend_eye.rb, line 8
def set_opt_http(params = {})
  if params[:enable]
    if @http
      if params[:host] != @http.host || params[:port].to_i != @http.port
        stop_http
        start_http(params[:host], params[:port])
      end
    else
      start_http(params[:host], params[:port])
    end
  else
    stop_http if @http
  end
end

Private Instance Methods

start_http(host, port) click to toggle source
# File lib/eye-http/extend_eye.rb, line 32
def start_http(host, port)
  require_relative 'http'
  @http = Eye::Http.new(host, port)
  @http.start
end
stop_http() click to toggle source
# File lib/eye-http/extend_eye.rb, line 25
def stop_http
  if @http
    @http.stop
    @http = nil
  end
end