Sha256: 85cf78257eb2ca58379c16edb6c280c2a20ca8e75105a9942894325cddebfafb

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 20124 Eric Crane.  All rights reserved.
#
# Configuration for a gloo web server.
#

module Gloo
  module WebSvr
    class Config

      SCHEME_SEPARATOR = '://'
      HTTP = 'http'
      HTTPS = 'https'
      LOCALHOST = 'localhost'
      PORT_DEFAULT = '8080'
      
      attr_reader :scheme, :host, :port
      

      # ---------------------------------------------------------------------
      #    Initialization
      # ---------------------------------------------------------------------

      #
      # Set up the web server.
      #
      def initialize( scheme = HTTP, host = LOCALHOST, port = PORT_DEFAULT )
        @scheme = scheme
        @host = host
        @port = port
      end


      # ---------------------------------------------------------------------
      #    Static Helper Functions
      # ---------------------------------------------------------------------


      # ---------------------------------------------------------------------
      #    Helper Functions
      # ---------------------------------------------------------------------

      # 
      # The base url, including scheme, host and port.
      # 
      def base_url
        url = "#{self.scheme}#{SCHEME_SEPARATOR}#{self.host}"
        unless self.port.blank? 
          url << ":#{self.port}"
        end
        return url
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gloo-3.3.0 lib/gloo/web_svr/config.rb
gloo-3.2.0 lib/gloo/web_svr/config.rb
gloo-3.1.1 lib/gloo/web_svr/config.rb
gloo-3.1.0 lib/gloo/web_svr/config.rb