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)


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

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


57
58
59
60
61
62
63
64
65
66
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 57

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

+ (Object) ENV_VARIABLE_NAME



70
71
72
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 70

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

+ (Object) j_api_type



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

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



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

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


44
45
46
47
48
49
50
51
52
53
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 44

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

+ (Object) SYSTEM_PROPERTY_NAME



67
68
69
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-web-common/web_environment.rb', line 67

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

+ (Object) unwrap(obj)



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

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

+ (Object) wrap(obj)



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

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