Class: Apes::RuntimeConfiguration
- Inherits:
-
Object
- Object
- Apes::RuntimeConfiguration
- Defined in:
- lib/apes/runtime_configuration.rb
Overview
Internal class to handle runtime configuration.
Class Method Summary (collapse)
-
+ (String) cors_source(default = "http://localhost")
Returns the CORS source used by Apes.
-
+ (Boolean) development?
Check if Rails is in development environment.
-
+ (String) environment(default = "development")
Returns the current Rails environment.
-
+ (String) gems_root(default = nil)
Returns the current RubyGems root directory.
-
+ (String) jwt_token(default = "secret")
Returns the JWT token used by Apes.
-
+ (String) rails_root(default = nil)
Returns the current Rails root directory.
-
+ (String) root
Returns the root directory of apes.
-
+ (Hash) timestamp_formats(default = {})
Returns a map where keys are tags and values are strftime compliant formats.
Class Method Details
+ (String) cors_source(default = "http://localhost")
Returns the CORS source used by Apes. This should be defined in the Rails secrets.yml file.
59 60 61 |
# File 'lib/apes/runtime_configuration.rb', line 59 def cors_source(default = "http://localhost") fetch_with_fallback(default) { Rails.application.secrets.cors_source } end |
+ (Boolean) development?
Check if Rails is in development environment.
43 44 45 |
# File 'lib/apes/runtime_configuration.rb', line 43 def development? environment == "development" end |
+ (String) environment(default = "development")
Returns the current Rails environment.
36 37 38 |
# File 'lib/apes/runtime_configuration.rb', line 36 def environment(default = "development") fetch_with_fallback(default) { Rails.env } end |
+ (String) gems_root(default = nil)
Returns the current RubyGems root directory.
28 29 30 |
# File 'lib/apes/runtime_configuration.rb', line 28 def gems_root(default = nil) fetch_with_fallback(default) { Pathname.new(Gem.loaded_specs["lazier"].full_gem_path).parent.to_s } end |
+ (String) jwt_token(default = "secret")
Returns the JWT token used by Apes. This should be defined in the Rails secrets.yml file.
51 52 53 |
# File 'lib/apes/runtime_configuration.rb', line 51 def jwt_token(default = "secret") fetch_with_fallback(default) { Rails.application.secrets.jwt } end |
+ (String) rails_root(default = nil)
Returns the current Rails root directory.
20 21 22 |
# File 'lib/apes/runtime_configuration.rb', line 20 def rails_root(default = nil) fetch_with_fallback(default) { Rails.root.to_s } end |
+ (String) root
Returns the root directory of apes.
12 13 14 |
# File 'lib/apes/runtime_configuration.rb', line 12 def root Pathname.new(Gem.loaded_specs["apes"].full_gem_path).to_s end |
+ (Hash) timestamp_formats(default = {})
Returns a map where keys are tags and values are strftime compliant formats.
67 68 69 |
# File 'lib/apes/runtime_configuration.rb', line 67 def (default = {}) fetch_with_fallback(default) { Rails.application.config. } end |