Class: VertxShell::Tty

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

Overview

Provide interactions with the Shell TTY.

Direct Known Subclasses

CommandProcess, Term

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


17
18
19
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/tty.rb', line 17

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

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



20
21
22
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/tty.rb', line 20

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

Instance Method Details

- (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)


47
48
49
50
51
52
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/tty.rb', line 47

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

- (self) resizehandler { ... }

Set a resize handler, the handler is called when the tty size changes.

Yields:

  • the resize handler

Returns:

  • (self)

Raises:

  • (ArgumentError)


76
77
78
79
80
81
82
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/tty.rb', line 76

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

- (self) stdin_handler { ... }

Set a stream handler on the standard input to read the data.

Yields:

  • the standard input

Returns:

  • (self)

Raises:

  • (ArgumentError)


56
57
58
59
60
61
62
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/tty.rb', line 56

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

- (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)


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

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)


40
41
42
43
44
45
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/tty.rb', line 40

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)

Write data to the standard output.

Parameters:

  • data (String) (defaults to: nil)
    the data to write

Returns:

  • (self)

Raises:

  • (ArgumentError)


66
67
68
69
70
71
72
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/tty.rb', line 66

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