Class: Swivel2::Config
- Inherits:
-
Struct
- Object
- Struct
- Swivel2::Config
- Defined in:
- lib/swivel2/config.rb
Instance Attribute Summary collapse
-
#extra_params ⇒ Object
Returns the value of attribute extra_params.
-
#site ⇒ Object
Returns the value of attribute site.
-
#timeout_read ⇒ Object
Returns the value of attribute timeout_read.
-
#timeout_write ⇒ Object
Returns the value of attribute timeout_write.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Config
constructor
A new instance of Config.
- #save(file = nil) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Config
Returns a new instance of Config.
7 8 9 |
# File 'lib/swivel2/config.rb', line 7 def initialize = {} .each do |k, v| self[k] = v end end |
Instance Attribute Details
#extra_params ⇒ Object
Returns the value of attribute extra_params
6 7 8 |
# File 'lib/swivel2/config.rb', line 6 def extra_params @extra_params end |
#site ⇒ Object
Returns the value of attribute site
6 7 8 |
# File 'lib/swivel2/config.rb', line 6 def site @site end |
#timeout_read ⇒ Object
Returns the value of attribute timeout_read
6 7 8 |
# File 'lib/swivel2/config.rb', line 6 def timeout_read @timeout_read end |
#timeout_write ⇒ Object
Returns the value of attribute timeout_write
6 7 8 |
# File 'lib/swivel2/config.rb', line 6 def timeout_write @timeout_write end |
Class Method Details
.default ⇒ Object
25 26 27 |
# File 'lib/swivel2/config.rb', line 25 def self.default @@default ||= self.load default_config_file end |
.load(file = nil) ⇒ Object
21 22 23 |
# File 'lib/swivel2/config.rb', line 21 def self.load file = nil YAML.load_file(file || config_file) end |
Instance Method Details
#save(file = nil) ⇒ Object
15 16 17 18 19 |
# File 'lib/swivel2/config.rb', line 15 def save file = nil File.open file || Config.config_file, 'w' do |f| YAML.dump self, f end end |