Module: Manticore::Client::TrustStrategies
- Defined in:
- lib/manticore/client/trust_strategies.rb
Overview
TrustStrategies is a utility module that provides helpers for working with org.apache.http.conn.ssl.TrustStrategy
Class Method Summary collapse
-
.coerce(coercible) ⇒ Object
Coerces to org.apache.http.conn.ssl.TrustStrategy, allowing nil pass-through.
-
.combine(lhs, rhs) ⇒ nil, org.apache.http.conn.ssl.TrustStrategy
Combines two possibly-nil TrustStrategies-coercible objects into a single org.apache.http.conn.ssl.TrustStrategy, or to nil if both are nil.
Class Method Details
.coerce(coercible) ⇒ nil, TrustStrategy .coerce(coercible) ⇒ Object
Coerces to org.apache.http.conn.ssl.TrustStrategy, allowing nil pass-through
29 30 31 32 33 34 35 |
# File 'lib/manticore/client/trust_strategies.rb', line 29 def self.coerce(coercible) case coercible when org.apache.http.conn.ssl.TrustStrategy, nil then coercible when ::Proc then CustomTrustStrategy.new(coercible) else fail(ArgumentError, "No implicit conversion of #{coercible} to #{self}") end end |
.combine(lhs, rhs) ⇒ nil, org.apache.http.conn.ssl.TrustStrategy
Combines two possibly-nil TrustStrategies-coercible objects into a single org.apache.http.conn.ssl.TrustStrategy, or to nil if both are nil.
43 44 45 46 47 48 |
# File 'lib/manticore/client/trust_strategies.rb', line 43 def self.combine(lhs, rhs) return coerce(rhs) if lhs.nil? return coerce(lhs) if rhs.nil? CombinedTrustStrategy.new(coerce(lhs), coerce(rhs)) end |