Class: VertxShell::Session

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

Overview

A shell session.

Instance Method Summary (collapse)

Instance Method Details

- (Object) get(key = nil)

Get some data from the session

Parameters:

  • key (String) (defaults to: nil)
    the key of the data

Returns:

  • (Object)
    the data

Raises:

  • (ArgumentError)


30
31
32
33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-shell/src/main/resources/vertx-shell/session.rb', line 30

def get(key=nil)
  if key.class == String && !block_given?
    return ::Vertx::Util::Utils.from_object(@j_del.java_method(:get, [Java::java.lang.String.java_class]).call(key))
  end
  raise ArgumentError, "Invalid arguments when calling get(key)"
end

- (self) put(key = nil, obj = nil)

Put some data in a session

Parameters:

  • key (String) (defaults to: nil)
    the key for the data
  • obj (Object) (defaults to: nil)
    the data

Returns:

  • (self)

Raises:

  • (ArgumentError)


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

def put(key=nil,obj=nil)
  if key.class == String && (obj.class == String  || obj.class == Hash || obj.class == Array || obj.class == NilClass || obj.class == TrueClass || obj.class == FalseClass || obj.class == Fixnum || obj.class == Float) && !block_given?
    @j_del.java_method(:put, [Java::java.lang.String.java_class,Java::java.lang.Object.java_class]).call(key,::Vertx::Util::Utils.to_object(obj))
    return self
  end
  raise ArgumentError, "Invalid arguments when calling put(key,obj)"
end

- (Object) remove(key = nil)

Remove some data from the session

Parameters:

  • key (String) (defaults to: nil)
    the key of the data

Returns:

  • (Object)
    the data that was there or null if none there

Raises:

  • (ArgumentError)


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

def remove(key=nil)
  if key.class == String && !block_given?
    return ::Vertx::Util::Utils.from_object(@j_del.java_method(:remove, [Java::java.lang.String.java_class]).call(key))
  end
  raise ArgumentError, "Invalid arguments when calling remove(key)"
end