Class | HTTPAuth::Digest::Conversions |
In: |
lib/httpauth/digest.rb
|
Parent: | Object |
Conversion for a number of internal data structures to and from directives in the headers. Implementations shouldn‘t have to call any methods on Conversions.
Creates a string value from a boolean => ‘true’ or ‘false‘
# File lib/httpauth/digest.rb, line 524 524: def bool_to_str(bool) 525: bool ? 'true' : 'false' 526: end
Creates an int value from hex values
# File lib/httpauth/digest.rb, line 509 509: def hex_to_int(str) 510: "0x#{str}".hex 511: end
Creates a hex value in a string from an integer
# File lib/httpauth/digest.rb, line 514 514: def int_to_hex(i) 515: i.to_s(16).rjust 8, '0' 516: end
Creates a quoted string with space separated items from a list
# File lib/httpauth/digest.rb, line 529 529: def list_to_quoted_string(list) 530: quote_string list.join(' ') 531: end
Adds quotes around the string
# File lib/httpauth/digest.rb, line 499 499: def quote_string(str) 500: "\"#{str.gsub('"', '')}\"" 501: end
Creates a list from a quoted space separated string of items
# File lib/httpauth/digest.rb, line 534 534: def quoted_string_to_list(string) 535: unquote_string(string).split ' ' 536: end
Creates a boolean value from a string => true or false
# File lib/httpauth/digest.rb, line 519 519: def str_to_bool(str) 520: str == 'true' 521: end