Class: PBSync::ClipboardSync
- Inherits:
-
Object
- Object
- PBSync::ClipboardSync
- Defined in:
- lib/pbsync/clipboard_sync.rb
Instance Attribute Summary collapse
-
#running ⇒ Object
readonly
Returns the value of attribute running.
Instance Method Summary collapse
-
#initialize(socket, clipboard_adapter: Clipboard) ⇒ ClipboardSync
constructor
A new instance of ClipboardSync.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(socket, clipboard_adapter: Clipboard) ⇒ ClipboardSync
Returns a new instance of ClipboardSync.
7 8 9 10 11 12 13 |
# File 'lib/pbsync/clipboard_sync.rb', line 7 def initialize(socket, clipboard_adapter: Clipboard) @socket = socket @clipboard = clipboard_adapter @last_clipboard_sent = nil @last_clipboard_received = nil @running = true end |
Instance Attribute Details
#running ⇒ Object (readonly)
Returns the value of attribute running.
5 6 7 |
# File 'lib/pbsync/clipboard_sync.rb', line 5 def running @running end |
Instance Method Details
#start ⇒ Object
15 16 17 18 |
# File 'lib/pbsync/clipboard_sync.rb', line 15 def start start_clipboard_monitor start_receive_loop end |
#stop ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/pbsync/clipboard_sync.rb', line 20 def stop @running = false begin @socket.close rescue StandardError nil end end |