class Middleman::LiveReload::Wss
Public Class Methods
new(certificate, private_key)
click to toggle source
# File lib/middleman-livereload/wss.rb, line 4 def initialize(certificate, private_key) @certificate = certificate @private_key = private_key validate! end
Public Instance Methods
scheme()
click to toggle source
# File lib/middleman-livereload/wss.rb, line 25 def scheme valid? ? "wss" : "ws" end
to_options()
click to toggle source
# File lib/middleman-livereload/wss.rb, line 14 def to_options return {} unless valid? { secure: true, tls_options: { private_key_file: @private_key, cert_chain_file: @certificate } } end
valid?()
click to toggle source
# File lib/middleman-livereload/wss.rb, line 10 def valid? @certificate && @private_key end
Private Instance Methods
present?()
click to toggle source
# File lib/middleman-livereload/wss.rb, line 31 def present? @certificate || @private_key end
validate!()
click to toggle source
# File lib/middleman-livereload/wss.rb, line 35 def validate! if present? && !valid? raise ArgumentError.new, "You must provide both :wss_certificate and :wss_private_key" end end