Class: Belly::Client::Config
- Inherits:
-
Object
- Object
- Belly::Client::Config
- Defined in:
- lib/belly/client/config.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #project ⇒ Object
- #url ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
19 20 21 22 |
# File 'lib/belly/client/config.rb', line 19 def initialize @default = DefaultConfig.new @host, @port = config_file['hub'].split(':') end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
6 7 8 |
# File 'lib/belly/client/config.rb', line 6 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
6 7 8 |
# File 'lib/belly/client/config.rb', line 6 def port @port end |
Class Method Details
.new(*args) ⇒ Object
9 10 11 12 |
# File 'lib/belly/client/config.rb', line 9 def new(*args) return DefaultConfig.new unless File.exists?(path) super end |
.path ⇒ Object
14 15 16 |
# File 'lib/belly/client/config.rb', line 14 def path File.('.belly') end |
Instance Method Details
#project ⇒ Object
28 29 30 |
# File 'lib/belly/client/config.rb', line 28 def project config_file['project'] || @default.project end |
#url ⇒ Object
24 25 26 |
# File 'lib/belly/client/config.rb', line 24 def url "http://#{@host}:#{@port}" end |
#user ⇒ Object
32 33 34 |
# File 'lib/belly/client/config.rb', line 32 def user config_file['user'] || @default.user end |