Class List Method List File List

# Class: VertxShell::Term

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

## Overview

The terminal.

## Instance Method Summary (collapse)

- - (void) close
  Close the connection to terminal.
- - (self) close_handler { ... }
  Set a handler that will be called when the terminal is closed.
- - (self) echo(text = nil)
  Echo some text in the terminal, escaped if necessary.
- - (self) interrupt_handler(handler = nil)
  Set an interrupt signal handler on the term.
- - (Fixnum) last_accessed_time
  @return the last time this term received input.
- - (void) readline(prompt = nil, lineHandler = nil) { ... }
  Prompt the user a line of text, providing a completion handler to handle user's completion.
- - (self) resizehandler { ... }
- - (::VertxShell::Term) set_session(session = nil)
  Associate the term with a session.
- - (self) stdin_handler { ... }
- - (self) suspend_handler(handler = nil)
  Set a suspend signal handler on the term.
- - (self) write(data = nil)

### Methods inherited from Tty

#height, #type, #width

## Instance Method Details

### - (`void`) close

This method returns an undefined value.

Close the connection to terminal.

Raises:

- (`ArgumentError`)

    120
    121
    122
    123
    124
    125
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 120

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

    111
    112
    113
    114
    115
    116
    117
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 111

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

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

    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

### - (`self`) interrupt_handler(handler = nil)

Set an interrupt signal handler on the term.

Parameters:

- handler (`::VertxShell::SignalHandler`) (defaults to: `nil`) —
  the interrupt handler

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

@return the last time this term received input

Returns:

- (`Fixnum`)

Raises:

- (`ArgumentError`)

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

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

    100
    101
    102
    103
    104
    105
    106
    107
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/term.rb', line 100

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

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

    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:

- session (`::VertxShell::Session`) (defaults to: `nil`) —
  the session to set

Returns:

- (`::VertxShell::Term`) —
  a reference to this, so the API can be used fluently

Raises:

- (`ArgumentError`)

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

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

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

    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:

- handler (`::VertxShell::SignalHandler`) (defaults to: `nil`) —
  the suspend handler

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    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

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

Parameters:

- data (`String`) (defaults to: `nil`)

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

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

    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