Class: VertxShell::Session

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb

Overview

A shell session.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


17
18
19
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb', line 17

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

+ (::VertxShell::Session) create

Create a new empty session.

Returns:

Raises:

  • (ArgumentError)


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

def self.create
  if !block_given?
    return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtShellSession::Session.java_method(:create, []).call(),::VertxShell::Session)
  end
  raise ArgumentError, "Invalid arguments when calling create()"
end

+ (Object) j_api_type



26
27
28
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb', line 26

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



29
30
31
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb', line 29

def self.j_class
  Java::IoVertxExtShellSession::Session.java_class
end

+ (Object) unwrap(obj)



23
24
25
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb', line 23

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

+ (Object) wrap(obj)



20
21
22
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb', line 20

def @@j_api_type.wrap(obj)
  Session.new(obj)
end

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)


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

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)


44
45
46
47
48
49
50
# File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb', line 44

def put(key=nil,obj=nil)
  if key.class == String && ::Vertx::Util::unknown_type.accept?(obj) && !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)


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

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