Sha256: 45c524649f6d27f20dc52a9fb24efdaea3ec2ddf76d812cd6fc9f20218b26567

Contents?: true

Size: 821 Bytes

Versions: 5

Compression:

Stored size: 821 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.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

5 entries across 5 versions & 1 rubygems

Version Path
ntail-0.0.11 lib/ntail/request.rb
ntail-0.0.10 lib/ntail/request.rb
ntail-0.0.9 lib/ntail/request.rb
ntail-0.0.8 lib/ntail/request.rb
ntail-0.0.7 lib/ntail/request.rb