Sha256: 2ef11955037d14f2eeb339ad705c77211d9ae4bf33255b5de00b8849156f9497

Contents?: true

Size: 834 Bytes

Versions: 13

Compression:

Stored size: 834 Bytes

Contents

module NginxTail
  module Request
    
    UNKNOWN_REQUEST = "-".freeze # the 'default' nginx value for $request variable
    
    def self.included(base) # :nodoc:
      base.class_eval do

        def self.unknown_request?(request)
          request == UNKNOWN_REQUEST
        end

        # this ensures the below module methods actually make sense...
        raise "Class #{base.name} should implement instance method 'request'" unless base.instance_methods.map(&:to_s).include? 'request'
        
      end
    end

    def unknown_request?
      self.class.unknown_request?(self.request)
    end

    def to_request_s
      if self.unknown_request?
        self.request
      else
        # note: we exclude the HTTP version info...
        "%s %s" % [self.to_http_method_s, self.to_uri_s]
      end
    end
        
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
ntail-1.3.1 lib/ntail/request.rb
ntail-1.3.0 lib/ntail/request.rb
ntail-1.2.0 lib/ntail/request.rb
ntail-1.1.4 lib/ntail/request.rb
ntail-1.1.3 lib/ntail/request.rb
ntail-1.1.2 lib/ntail/request.rb
ntail-1.1.1 lib/ntail/request.rb
ntail-1.1.0 lib/ntail/request.rb
ntail-1.0.2 lib/ntail/request.rb
ntail-1.0.0 lib/ntail/request.rb
ntail-0.2.0 lib/ntail/request.rb
ntail-0.1.0 lib/ntail/request.rb
ntail-0.0.12 lib/ntail/request.rb