Class List Method List File List

# Class: VertxShell::Pty

Inherits:
  Object
  - Object
  - VertxShell::Pty
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/pty.rb

## Overview

A pseudo terminal used for controlling a Tty. This interface acts as a pseudo terminal master, #slave returns the assocated slave pseudo terminal.

## Class Method Summary (collapse)

- + (::VertxShell::Pty) create(terminalType = nil)
  Create a new pseudo terminal.

## Instance Method Summary (collapse)

- - (self) set_size(width = nil, height = nil)
  Resize the terminal.
- - (::VertxShell::Tty) slave
  @return the pseudo terminal slave.
- - (self) stdout_handler { ... }
  Set the standard out handler of the pseudo terminal.
- - (self) write(data = nil)
  Write data to the slave standard input of the pseudo terminal.

## Class Method Details

### + (`::VertxShell::Pty`) create(terminalType = nil)

Create a new pseudo terminal.

Parameters:

- terminalType (`String`) (defaults to: `nil`) —
  the terminal type, for instance

Returns:

- (`::VertxShell::Pty`) —
  the created pseudo terminal

Raises:

- (`ArgumentError`)

    21
    22
    23
    24
    25
    26
    27
    28
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/pty.rb', line 21

    def self.create(terminalType=nil)
      if !block_given? && terminalType == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::Pty.java_method(:create, []).call(),::VertxShell::Pty)
      elsif terminalType.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellTerm::Pty.java_method(:create, [Java::java.lang.String.java_class]).call(terminalType),::VertxShell::Pty)
      end
      raise ArgumentError, "Invalid arguments when calling create(terminalType)"
    end

## Instance Method Details

### - (`self`) set_size(width = nil, height = nil)

Resize the terminal.

Parameters:

- width (`Fixnum`) (defaults to: `nil`)
- height (`Fixnum`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    def set_size(width=nil,height=nil)
      if width.class == Fixnum && height.class == Fixnum && !block_given?
        @j_del.java_method(:setSize, [Java::int.java_class,Java::int.java_class]).call(width,height)
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_size(width,height)"
    end

### - (`::VertxShell::Tty`) slave

@return the pseudo terminal slave

Returns:

- (`::VertxShell::Tty`)

Raises:

- (`ArgumentError`)

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

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

### - (`self`) stdout_handler { ... }

Set the standard out handler of the pseudo terminal.

Yields:

- the standard output

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

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

### - (`self`) write(data = nil)

Write data to the slave standard input of the pseudo terminal.

Parameters:

- data (`String`) (defaults to: `nil`) —
  the data to write

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    42
    43
    44
    45
    46
    47
    48
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/pty.rb', line 42

    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