Class: ViewServer::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/view_server/server.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(launcher = Launcher.new) ⇒ Server

Returns a new instance of Server.



9
10
11
12
# File 'lib/view_server/server.rb', line 9

def initialize(launcher = Launcher.new)
  @launcher = launcher
  @clipboard = MyClipboard
end

Instance Attribute Details

#launcherObject (readonly)

Returns the value of attribute launcher.



7
8
9
# File 'lib/view_server/server.rb', line 7

def launcher
  @launcher
end

Class Method Details

.serve(launcher = Launcher.new, port) ⇒ Object



28
29
30
31
32
# File 'lib/view_server/server.rb', line 28

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

#copy(str) ⇒ Object



20
21
22
# File 'lib/view_server/server.rb', line 20

def copy(str)
  @clipboard.copy(str)
end

#pasteObject



24
25
26
# File 'lib/view_server/server.rb', line 24

def paste
  @clipboard.paste
end

#show(data, file_ext = 'txt') ⇒ Object

I wanted to use the display method but it conflicts with the Object#display method



16
17
18
# File 'lib/view_server/server.rb', line 16

def show(data, file_ext = 'txt')
  launcher.launch(data, file_ext)
end