Class List Method List File List

# Class: VertxShell::Session

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

## Overview

A shell session.

## Class Method Summary (collapse)

- + (::VertxShell::Session) create
  Create a new empty session.

## Instance Method Summary (collapse)

- - (Object) get(key = nil)
  Get some data from the session.
- - (self) put(key = nil, obj = nil)
  Put some data in a session.
- - (Object) remove(key = nil)
  Remove some data from the session.

## Class Method Details

### + (`::VertxShell::Session`) create

Create a new empty session.

Returns:

- (`::VertxShell::Session`) —
  the created session

Raises:

- (`ArgumentError`)

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

    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

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

    38
    39
    40
    41
    42
    43
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-shell/session.rb', line 38

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

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

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

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

    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