Class List Method List File List

# Class: VertxShell::Tty

Inherits:
  Object
  - Object
  - VertxShell::Tty
  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

## Instance Method Summary (collapse)

- - (Fixnum) height
  @return the current height, i.e the number of columns or if unknown.
- - (self) resizehandler { ... }
  Set a resize handler, the handler is called when the tty size changes.
- - (self) stdin_handler { ... }
  Set a stream handler on the standard input to read the data.
- - (String) type
  @return the declared tty type, for instance , , etc...
- - (Fixnum) width
  @return the current width, i.e the number of rows or if unknown.
- - (self) write(data = nil)
  Write data to the standard output.

## Instance Method Details

### - (`Fixnum`) height

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

Returns:

- (`Fixnum`)

Raises:

- (`ArgumentError`)

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

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

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

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

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

    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

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

Returns:

- (`String`)

Raises:

- (`ArgumentError`)

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

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

### - (`Fixnum`) width

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

Returns:

- (`Fixnum`)

Raises:

- (`ArgumentError`)

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

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

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

    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