Class: VertxShell::Stream

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

Overview

@author Julien Viet

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (::VertxShell::Stream) of_json { ... }

Yields:

Returns:

Raises:

  • (ArgumentError)


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

def self.of_json
  if block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellIo::Stream.java_method(:ofJson, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event != nil ? JSON.parse(event.encode) : nil) })),::VertxShell::Stream)
  end
  raise ArgumentError, "Invalid arguments when calling of_json()"
end

+ (::VertxShell::Stream) of_string { ... }

Yields:

Returns:

Raises:

  • (ArgumentError)


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

def self.of_string
  if block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellIo::Stream.java_method(:ofString, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |event| yield(event) })),::VertxShell::Stream)
  end
  raise ArgumentError, "Invalid arguments when calling of_string()"
end

Instance Method Details

- (self) write(data) - (self) write(data)

Overloads:

  • - (self) write(data)

    Parameters:

    • data (String)
  • - (self) write(data)

    Parameters:

    • data (Hash{String => Object})

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def write(param_1=nil)
  if param_1.class == String && !block_given?
    @j_del.java_method(:write, [Java::java.lang.String.java_class]).call(param_1)
    return self
  elsif param_1.class == Hash && !block_given?
    @j_del.java_method(:write, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(param_1))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling write(param_1)"
end