mirror of
				https://gitea.invidious.io/iv-org/shard-athena-negotiation.git
				synced 2024-08-15 00:53:23 +00:00 
			
		
		
		
	
							parent
							
								
									96fe9291e3
								
							
						
					
					
						commit
						4c2e6b96ef
					
				
					 2 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
					@ -11,6 +11,8 @@ abstract class Athena::Negotiation::AbstractNegotiator(HeaderType)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Returns the best `HeaderType` type based on the provided *header* value and *priorities*.
 | 
					  # Returns the best `HeaderType` type based on the provided *header* value and *priorities*.
 | 
				
			||||||
  #
 | 
					  #
 | 
				
			||||||
 | 
					  # If *strict* is `true`, an `ANG::Exceptions::Exception` will be raised if the *header* contains an invalid value, otherwise it is ignored.
 | 
				
			||||||
 | 
					  #
 | 
				
			||||||
  # See `Athena::Negotiation` for examples.
 | 
					  # See `Athena::Negotiation` for examples.
 | 
				
			||||||
  def best(header : String, priorities : Indexable(String), strict : Bool = false) : HeaderType?
 | 
					  def best(header : String, priorities : Indexable(String), strict : Bool = false) : HeaderType?
 | 
				
			||||||
    raise ArgumentError.new "priorities should not be empty." if priorities.empty?
 | 
					    raise ArgumentError.new "priorities should not be empty." if priorities.empty?
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,7 @@ alias ANG = Athena::Negotiation
 | 
				
			||||||
# accept.coding # => "gzip"
 | 
					# accept.coding # => "gzip"
 | 
				
			||||||
# ```
 | 
					# ```
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# The `ANG::EncodingNegotiator` type returns an `ANG::AcceptEncoding`, or `nil` if negotiating the best character set has failed.
 | 
					# The `ANG::EncodingNegotiator` type returns an `ANG::AcceptEncoding`, or `nil` if negotiating the best encoding has failed.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# ### Language
 | 
					# ### Language
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,7 @@ alias ANG = Athena::Negotiation
 | 
				
			||||||
# accept.script   # => "hans"
 | 
					# accept.script   # => "hans"
 | 
				
			||||||
# ```
 | 
					# ```
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# The `ANG::LanguageNegotiator` type returns an `ANG::AcceptLanguage`, or `nil` if negotiating the best character set has failed.
 | 
					# The `ANG::LanguageNegotiator` type returns an `ANG::AcceptLanguage`, or `nil` if negotiating the best language has failed.
 | 
				
			||||||
module Athena::Negotiation
 | 
					module Athena::Negotiation
 | 
				
			||||||
  # Returns a lazily initialized `ANG::Negotiator` singleton instance.
 | 
					  # Returns a lazily initialized `ANG::Negotiator` singleton instance.
 | 
				
			||||||
  class_getter(negotiator) { ANG::Negotiator.new }
 | 
					  class_getter(negotiator) { ANG::Negotiator.new }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue