Module: FCS::Config
- Included in:
- FCS
- Defined in:
- lib/fcs/config.rb
Constant Summary collapse
- DEFAULT_REMOTE_HOST =
Remote host used if none is set
'http://127.0.0.1'
- DEFAULT_REMOTE_PORT =
Remote port used if none is set
'8021'
- DEFAULT_LOCAL_HOST =
Local host used if none is set
nil
- DEFAULT_LOCAL_PORT =
Local port used if none is set
nil
- DEFAULT_AUTO_CONNECT =
Auto connect value used if none is set
true
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring a FCS::Client
[ :remote_host, :remote_port, :local_host, :local_port, :auto_connect ]
Class Method Summary collapse
-
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default value.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default value
30 31 32 |
# File 'lib/fcs/config.rb', line 30 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
35 36 37 38 |
# File 'lib/fcs/config.rb', line 35 def configure yield self self end |
#options ⇒ Object
Create a hash of options and their values
41 42 43 44 45 |
# File 'lib/fcs/config.rb', line 41 def = {} VALID_OPTIONS_KEYS.each {|k| [k] = send(k)} end |
#reset ⇒ Object
Reset all configuration options to defaults
48 49 50 51 52 53 54 55 |
# File 'lib/fcs/config.rb', line 48 def reset self.remote_host = DEFAULT_REMOTE_HOST self.remote_port = DEFAULT_REMOTE_PORT self.local_host = DEFAULT_LOCAL_HOST self.local_port = DEFAULT_LOCAL_PORT self.auto_connect = DEFAULT_AUTO_CONNECT self end |