Class: UU::Remote

Inherits:
Object
  • Object
show all
Defined in:
lib/uu/remote.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri) ⇒ Remote

Returns a new instance of Remote.



17
18
19
# File 'lib/uu/remote.rb', line 17

def initialize(uri)
  @remote = DRbObject.new_with_uri(uri)
end

Class Method Details

.start_serviceObject



9
10
11
# File 'lib/uu/remote.rb', line 9

def self.start_service
  DRb.start_service
end

.stop_serviceObject



13
14
15
# File 'lib/uu/remote.rb', line 13

def self.stop_service
  DRb.stop_service
end

Instance Method Details

#disableObject



21
22
23
# File 'lib/uu/remote.rb', line 21

def disable
  @remote.disable
end

#enableObject



25
26
27
# File 'lib/uu/remote.rb', line 25

def enable
  @remote.enable
end

#enable_at_exitObject



44
45
46
# File 'lib/uu/remote.rb', line 44

def enable_at_exit
  at_exit { enable }
end

#eval_(code) ⇒ Object



29
30
31
# File 'lib/uu/remote.rb', line 29

def eval_(code)
  @remote.eval_(code)
end

#klass(klass_) ⇒ Object



33
34
35
# File 'lib/uu/remote.rb', line 33

def klass(klass_)
  @remote.klass(klass_.to_s)
end

#run(&block) ⇒ Object



37
38
39
40
41
42
# File 'lib/uu/remote.rb', line 37

def run(&block)
  disable
  instance_eval(&block)
ensure
  enable
end