module ADAL::Util

Various helper methods that are useful across several classes and do not fit into the class hierarchy.

Public Instance Methods

fail_if_arguments_nil(*args) click to toggle source
# File lib/adal/util.rb, line 27
def fail_if_arguments_nil(*args)
  fail ArgumentError, 'Arguments cannot be nil.' if args.any?(&:nil?)
end
http(uri) click to toggle source

@param URI|String @return Net::HTTP

# File lib/adal/util.rb, line 33
def http(uri)
  uri = URI.parse(uri.to_s)
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.scheme == 'https'
  http
end
string_hash(hash) click to toggle source

Converts every key and value of a hash to string.

@param Hash @return Hash

# File lib/adal/util.rb, line 45
def string_hash(hash)
  hash.map { |k, v| [k.to_s, v.to_s] }.to_h
end