Class: Stack::Configuration
- Inherits:
-
Object
- Object
- Stack::Configuration
- Defined in:
- lib/stack/configuration.rb
Instance Attribute Summary collapse
-
#server_port ⇒ Object
Returns the value of attribute server_port.
-
#server_watch ⇒ Object
Returns the value of attribute server_watch.
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #from_hash(hash) ⇒ Object
-
#initialize(hash = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #to_hash ⇒ Object
Constructor Details
#initialize(hash = nil) ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 |
# File 'lib/stack/configuration.rb', line 6 def initialize(hash = nil) self.from_hash(hash) end |
Instance Attribute Details
#server_port ⇒ Object
Returns the value of attribute server_port.
4 5 6 |
# File 'lib/stack/configuration.rb', line 4 def server_port @server_port end |
#server_watch ⇒ Object
Returns the value of attribute server_watch.
4 5 6 |
# File 'lib/stack/configuration.rb', line 4 def server_watch @server_watch end |
#source ⇒ Object
Returns the value of attribute source.
3 4 5 |
# File 'lib/stack/configuration.rb', line 3 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
3 4 5 |
# File 'lib/stack/configuration.rb', line 3 def target @target end |
Instance Method Details
#from_hash(hash) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/stack/configuration.rb', line 10 def from_hash(hash) if (hash != nil) @source = hash[:source] @target = hash[:target] @server_port = hash[:server][:port] @server_watch = hash[:server][:watch] end end |
#to_hash ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/stack/configuration.rb', line 19 def to_hash { :source => self.source, :target => self.target, :server => { :port => self.server_port, :watch => self.server_watch } } end |