Class: Pry::Shell::Client

Inherits:
Object
  • Object
show all
Includes:
DRb::DRbUndumped
Defined in:
lib/pry/shell/client.rb

Constant Summary collapse

MAX_PROCESS_NAME =
50

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, process_name, host, pid, location) ⇒ Client

Returns a new instance of Client.



16
17
18
19
20
21
22
23
# File 'lib/pry/shell/client.rb', line 16

def initialize(id, process_name, host, pid, location)
  @id = id
  @process_name = process_name
  @host = host
  @location = location
  @pid = pid
  @created_at = Time.now
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



14
15
16
# File 'lib/pry/shell/client.rb', line 14

def id
  @id
end

Instance Method Details

#current?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/pry/shell/client.rb', line 45

def current?
  Shell.registry.current == self
end

#editorObject



33
34
35
# File 'lib/pry/shell/client.rb', line 33

def editor
  @editor ||= proc { |file, line| IO::Editor.open(file, line) }
end

#inputObject



25
26
27
# File 'lib/pry/shell/client.rb', line 25

def input
  @input ||= IO::Input.new(self, Pry.config.input)
end

#outputObject



29
30
31
# File 'lib/pry/shell/client.rb', line 29

def output
  @output ||= IO::Output.new(self, Pry.config.output)
end

#pager_proxyObject



37
38
39
# File 'lib/pry/shell/client.rb', line 37

def pager_proxy
  @pager_proxy ||= IO::Pager::Proxy.new(output)
end

#to_sObject



41
42
43
# File 'lib/pry/shell/client.rb', line 41

def to_s
  "[#{pid}] \"#{humanized_process_name}\" @\"#{host}\" - #{full_location}"
end