Class: ViewServer::Server
- Inherits:
-
Object
- Object
- ViewServer::Server
- Defined in:
- lib/view_server/server.rb
Instance Attribute Summary collapse
-
#clipboard ⇒ Object
readonly
Returns the value of attribute clipboard.
-
#launcher ⇒ Object
readonly
Returns the value of attribute launcher.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(launcher = Launcher.new) ⇒ Server
constructor
A new instance of Server.
-
#paste ⇒ Object
From clipboard.
-
#show(data, file_ext = 'txt') ⇒ Object
I wanted to use the display method but it conflicts with the Object#display method.
-
#to_cb(data) ⇒ Object
To clipboard.
Constructor Details
#initialize(launcher = Launcher.new) ⇒ Server
Returns a new instance of Server.
8 9 10 11 |
# File 'lib/view_server/server.rb', line 8 def initialize(launcher = Launcher.new) @launcher = launcher @clipboard = Clipboard end |
Instance Attribute Details
#clipboard ⇒ Object (readonly)
Returns the value of attribute clipboard.
6 7 8 |
# File 'lib/view_server/server.rb', line 6 def clipboard @clipboard end |
#launcher ⇒ Object (readonly)
Returns the value of attribute launcher.
6 7 8 |
# File 'lib/view_server/server.rb', line 6 def launcher @launcher end |
Class Method Details
.serve(launcher = Launcher.new, port) ⇒ Object
27 28 29 30 31 |
# File 'lib/view_server/server.rb', line 27 def self.serve(launcher = Launcher.new, port) DRb.start_service "druby://localhost:#{port}", Server.new puts DRb.uri DRb.thread.join end |
Instance Method Details
#paste ⇒ Object
From clipboard
23 24 25 |
# File 'lib/view_server/server.rb', line 23 def paste # From clipboard clipboard.paste end |
#show(data, file_ext = 'txt') ⇒ Object
I wanted to use the display method but it conflicts with the Object#display method
15 16 17 |
# File 'lib/view_server/server.rb', line 15 def show(data, file_ext = 'txt') launcher.launch(data, file_ext) end |
#to_cb(data) ⇒ Object
To clipboard
19 20 21 |
# File 'lib/view_server/server.rb', line 19 def to_cb(data) # To clipboard clipboard.copy(data) end |