Class: VertxShell::Pty

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


19
20
21
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 19

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

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

Create a new pseudo terminal.

Parameters:

  • terminalType (String) (defaults to: nil)
    the terminal type, for instance

Returns:

Raises:

  • (ArgumentError)


37
38
39
40
41
42
43
44
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 37

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

+ (Object) j_api_type



28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 28

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



31
32
33
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 31

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

+ (Object) unwrap(obj)



25
26
27
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 25

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

+ (Object) wrap(obj)



22
23
24
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 22

def @@j_api_type.wrap(obj)
  Pty.new(obj)
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)


69
70
71
72
73
74
75
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 69

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

Returns the pseudo terminal slave

Returns:

Raises:

  • (ArgumentError)


77
78
79
80
81
82
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 77

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)


48
49
50
51
52
53
54
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 48

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)


58
59
60
61
62
63
64
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-shell/pty.rb', line 58

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