Class List Method List File List

# Class: VertxShell::Tty

Inherits:
  Object
  - Object
  - VertxShell::Tty
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/tty.rb

## Overview

Provide interactions with the Shell TTY.

## Direct Known Subclasses

CommandProcess

## Instance Method Summary (collapse)

- - (self) event_handler(eventType = nil) { ... }
  Set an event handler to be notified by Shell events.
- - (Fixnum) height
  @return the current height, i.e the number of columns or if unknown.
- - (self) set_stdin(stdin = nil) { ... }
  Set an handler the standard input to read the data in String format.
- - (::VertxShell::Stream) stdout
  @return the standard output for emitting data.
- - (Fixnum) width
  @return the current width, i.e the number of rows or if unknown.

## Instance Method Details

### - (`self`) event_handler(eventType = nil) { ... }

Set an event handler to be notified by Shell events.

Parameters:

- eventType (`:SIGTSTP`, `:EOF`, `:SIGINT`, `:SIGWINCH`, `:SIGCONT`) (defaults to: `nil`) —
  the event type

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    64
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/tty.rb', line 58

    def event_handler(eventType=nil)
      if eventType.class == Symbol && block_given?
        @j_del.java_method(:eventHandler, [Java::IoVertxExtShellIo::EventType.java_class,Java::IoVertxCore::Handler.java_class]).call(Java::IoVertxExtShellIo::EventType.valueOf(eventType),Proc.new { yield })
        return self
      end
      raise ArgumentError, "Invalid arguments when calling event_handler(eventType)"
    end

### - (`Fixnum`) height

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

Returns:

- (`Fixnum`)

Raises:

- (`ArgumentError`)

    27
    28
    29
    30
    31
    32
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/tty.rb', line 27

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

### - (`self`) set_stdin(stdin = nil) { ... }

Set an handler the standard input to read the data in String format.

Yields:

- the standard input

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/tty.rb', line 36

    def set_stdin(stdin=nil)
      if stdin.class.method_defined?(:j_del) && !block_given?
        @j_del.java_method(:setStdin, [Java::IoVertxExtShellIo::Stream.java_class]).call(stdin.j_del)
        return self
      elsif block_given? && stdin == nil
        @j_del.java_method(:setStdin, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_stdin(stdin)"
    end

### - (`::VertxShell::Stream`) stdout

@return the standard output for emitting data

Returns:

- (`::VertxShell::Stream`)

Raises:

- (`ArgumentError`)

    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/tty.rb', line 48

    def stdout
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:stdout, []).call(),::VertxShell::Stream)
      end
      raise ArgumentError, "Invalid arguments when calling stdout()"
    end

### - (`Fixnum`) width

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

Returns:

- (`Fixnum`)

Raises:

- (`ArgumentError`)

    19
    20
    21
    22
    23
    24
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/tty.rb', line 19

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