Class: Eli::Config
- Inherits:
-
Object
- Object
- Eli::Config
- Defined in:
- lib/eli/config.rb
Overview
Documentation for Eli::Config.
Holds the configuration used by the library, the most important being the base URL of the Letmein server the client talks to.
Constant Summary collapse
- DEFAULT_BASE_URL =
"http://localhost:4000"
Class Method Summary collapse
-
.base_url ⇒ Object
Get base_url value.
-
.base_url=(value) ⇒ Object
Set base_url value.
-
.reset! ⇒ Object
Resets any value set through
base_url=(useful for tests).
Class Method Details
.base_url ⇒ Object
Get base_url value.
Falls back to the LETMEIN_BASE_URL environment variable and finally to
DEFAULT_BASE_URL when nothing was explicitly configured.
Example
Eli::Config.base_url
29 30 31 |
# File 'lib/eli/config.rb', line 29 def base_url @base_url || ENV["LETMEIN_BASE_URL"] || DEFAULT_BASE_URL end |
.base_url=(value) ⇒ Object
16 17 18 19 20 |
# File 'lib/eli/config.rb', line 16 def base_url=(value) raise ArgumentError, "base_url must be a string" unless value.is_a?(String) @base_url = value end |
.reset! ⇒ Object
Resets any value set through base_url= (useful for tests).
34 35 36 |
# File 'lib/eli/config.rb', line 34 def reset! @base_url = nil end |