Class: VertxWebCommon::WebEnvironment

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb

Overview

Utility API to verify which environment is the web application running. The utility will check initially for the existence of a system property under the name `vertx.mode`, if there is no such property then it will look under the environment variables under the name `VERTX_MODE`. This value will be then used when the API is invoked. By itself this utility will not affect the behavior of your application, however you can use it to simplify your handlers, e.g.: When the development mode is active you can log more information or disable caches.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)

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

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

+ (true, false) development?

Will return true if the mode is not null and equals ignoring case the string "dev"

Returns:

  • (true, false)
    always boolean

Raises:

  • (ArgumentError)

42
43
44
45
46
47
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 42

def self.development?
  if !block_given?
    return Java::IoVertxExtWebCommon::WebEnvironment.java_method(:development, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling development?()"
end

+ (Object) ENV_VARIABLE_NAME


59
60
61
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 59

def self.ENV_VARIABLE_NAME
  Java::IoVertxExtWebCommon::WebEnvironment.ENV_VARIABLE_NAME
end

+ (Object) j_api_type


34
35
36
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 34

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class


37
38
39
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 37

def self.j_class
  Java::IoVertxExtWebCommon::WebEnvironment.java_class
end

+ (String) mode

The current mode from the system properties with fallback to environment variables

Returns:

  • (String)
    String with mode value or null

Raises:

  • (ArgumentError)

50
51
52
53
54
55
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 50

def self.mode
  if !block_given?
    return Java::IoVertxExtWebCommon::WebEnvironment.java_method(:mode, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling mode()"
end

+ (Object) SYSTEM_PROPERTY_NAME


56
57
58
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 56

def self.SYSTEM_PROPERTY_NAME
  Java::IoVertxExtWebCommon::WebEnvironment.SYSTEM_PROPERTY_NAME
end

+ (Object) unwrap(obj)


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

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

+ (Object) wrap(obj)


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

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