Class: VertxShell::Term

Inherits:
Tty
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb

Overview

The terminal.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


22
23
24
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 22

def @@j_api_type.accept?(obj)
  obj.class == Term
end

+ (Object) j_api_type



31
32
33
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 31

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



34
35
36
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 34

def self.j_class
  Java::IoVertxExtShellTerm::Term.java_class
end

+ (Object) unwrap(obj)



28
29
30
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 28

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



25
26
27
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 25

def @@j_api_type.wrap(obj)
  Term.new(obj)
end

Instance Method Details

- (void) close

This method returns an undefined value.

Close the connection to terminal.

Raises:

  • (ArgumentError)


156
157
158
159
160
161
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 156

def close
  if !block_given?
    return @j_del.java_method(:close, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling close()"
end

- (self) close_handler { ... }

Set a handler that will be called when the terminal is closed.

Yields:

  • the handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


147
148
149
150
151
152
153
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 147

def close_handler
  if block_given?
    @j_del.java_method(:closeHandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling close_handler()"
end

- (self) echo(text = nil)

Echo some text in the terminal, escaped if necessary.

Parameters:

  • text (String) (defaults to: nil)
    the text to echo

Returns:

  • (self)

Raises:

  • (ArgumentError)


95
96
97
98
99
100
101
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 95

def echo(text=nil)
  if text.class == String && !block_given?
    @j_del.java_method(:echo, [Java::java.lang.String.java_class]).call(text)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling echo(#{text})"
end

- (Fixnum) height

Returns the current height, i.e the number of columns or if unknown

Returns:

  • (Fixnum)
    the current height, i.e the number of columns or if unknown

Raises:

  • (ArgumentError)


52
53
54
55
56
57
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 52

def height
  if !block_given?
    return @j_del.java_method(:height, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling height()"
end

- (self) interrupt_handler(handler = nil)

Set an interrupt signal handler on the term.

Parameters:

Returns:

  • (self)

Raises:

  • (ArgumentError)


114
115
116
117
118
119
120
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 114

def interrupt_handler(handler=nil)
  if handler.class.method_defined?(:j_del) && !block_given?
    @j_del.java_method(:interruptHandler, [Java::IoVertxExtShellTerm::SignalHandler.java_class]).call(handler.j_del)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling interrupt_handler(#{handler})"
end

- (Fixnum) last_accessed_time

Returns the last time this term received input

Returns:

  • (Fixnum)
    the last time this term received input

Raises:

  • (ArgumentError)


86
87
88
89
90
91
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 86

def last_accessed_time
  if !block_given?
    return @j_del.java_method(:lastAccessedTime, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling last_accessed_time()"
end

- (void) readline(prompt = nil, lineHandler = nil) { ... }

This method returns an undefined value.

Prompt the user a line of text, providing a completion handler to handle user's completion.

Parameters:

  • prompt (String) (defaults to: nil)
    the displayed prompt
  • lineHandler (Proc) (defaults to: nil)
    the line handler called with the line

Yields:

  • the completion handler

Raises:

  • (ArgumentError)


136
137
138
139
140
141
142
143
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 136

def readline(prompt=nil,lineHandler=nil)
  if prompt.class == String && block_given? && lineHandler == nil
    return @j_del.java_method(:readline, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(prompt,(Proc.new { |event| yield(event) }))
  elsif prompt.class == String && lineHandler.class == Proc && block_given?
    return @j_del.java_method(:readline, [Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Handler.java_class]).call(prompt,(Proc.new { |event| lineHandler.call(event) }),(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxShell::Completion)) }))
  end
  raise ArgumentError, "Invalid arguments when calling readline(#{prompt},#{lineHandler})"
end

- (self) resizehandler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


60
61
62
63
64
65
66
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 60

def resizehandler
  if block_given?
    @j_del.java_method(:resizehandler, [Java::IoVertxCore::Handler.java_class]).call(Proc.new { yield })
    return self
  end
  raise ArgumentError, "Invalid arguments when calling resizehandler()"
end

- (::VertxShell::Term) set_session(session = nil)

Associate the term with a session.

Parameters:

Returns:

Raises:

  • (ArgumentError)


105
106
107
108
109
110
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 105

def set_session(session=nil)
  if session.class.method_defined?(:j_del) && !block_given?
    return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:setSession, [Java::IoVertxExtShellSession::Session.java_class]).call(session.j_del),::VertxShell::Term)
  end
  raise ArgumentError, "Invalid arguments when calling set_session(#{session})"
end

- (self) stdin_handler { ... }

Yields:

Returns:

  • (self)

Raises:

  • (ArgumentError)


69
70
71
72
73
74
75
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 69

def stdin_handler
  if block_given?
    @j_del.java_method(:stdinHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event) }))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling stdin_handler()"
end

- (self) suspend_handler(handler = nil)

Set a suspend signal handler on the term.

Parameters:

Returns:

  • (self)

Raises:

  • (ArgumentError)


124
125
126
127
128
129
130
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 124

def suspend_handler(handler=nil)
  if handler.class.method_defined?(:j_del) && !block_given?
    @j_del.java_method(:suspendHandler, [Java::IoVertxExtShellTerm::SignalHandler.java_class]).call(handler.j_del)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling suspend_handler(#{handler})"
end

- (String) type

Returns the declared tty type, for instance , , etc... it can be null when the tty does not have declared its type.

Returns:

  • (String)
    the declared tty type, for instance , , etc... it can be null when the tty does not have declared its type.

Raises:

  • (ArgumentError)


38
39
40
41
42
43
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 38

def type
  if !block_given?
    return @j_del.java_method(:type, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling type()"
end

- (Fixnum) width

Returns the current width, i.e the number of rows or if unknown

Returns:

  • (Fixnum)
    the current width, i.e the number of rows or if unknown

Raises:

  • (ArgumentError)


45
46
47
48
49
50
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 45

def width
  if !block_given?
    return @j_del.java_method(:width, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling width()"
end

- (self) write(data = nil)

Parameters:

  • data (String) (defaults to: nil)

Returns:

  • (self)

Raises:

  • (ArgumentError)


78
79
80
81
82
83
84
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 78

def write(data=nil)
  if data.class == String && !block_given?
    @j_del.java_method(:write, [Java::java.lang.String.java_class]).call(data)
    return self
  end
  raise ArgumentError, "Invalid arguments when calling write(#{data})"
end