Class: Middleman::LiveReload::Wss
- Inherits:
-
Object
- Object
- Middleman::LiveReload::Wss
- Defined in:
- lib/middleman-livereload/wss.rb
Instance Method Summary collapse
-
#initialize(certificate, private_key) ⇒ Wss
constructor
A new instance of Wss.
- #scheme ⇒ Object
- #to_options ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(certificate, private_key) ⇒ Wss
Returns a new instance of Wss.
4 5 6 7 8 |
# File 'lib/middleman-livereload/wss.rb', line 4 def initialize(certificate, private_key) @certificate = certificate @private_key = private_key validate! end |
Instance Method Details
#scheme ⇒ Object
25 26 27 |
# File 'lib/middleman-livereload/wss.rb', line 25 def scheme valid? ? "wss" : "ws" end |
#to_options ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/middleman-livereload/wss.rb', line 14 def return {} unless valid? { secure: true, tls_options: { private_key_file: @private_key, cert_chain_file: @certificate } } end |
#valid? ⇒ Boolean
10 11 12 |
# File 'lib/middleman-livereload/wss.rb', line 10 def valid? @certificate && @private_key end |