Class: CFoundry::V2::App::Instance
- Inherits:
-
Object
- Object
- CFoundry::V2::App::Instance
- Defined in:
- lib/cfoundry/v2/app.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #console ⇒ Object
- #debugger ⇒ Object
- #file(*path) ⇒ Object
- #files(*path) ⇒ Object
- #healthy? ⇒ Boolean
-
#initialize(app, id, client, manifest = {}) ⇒ Instance
constructor
A new instance of Instance.
- #inspect ⇒ Object
- #since ⇒ Object
- #state ⇒ Object (also: #status)
Constructor Details
#initialize(app, id, client, manifest = {}) ⇒ Instance
Returns a new instance of Instance.
258 259 260 261 262 263 |
# File 'lib/cfoundry/v2/app.rb', line 258 def initialize(app, id, client, manifest = {}) @app = app @id = id @client = client @manifest = manifest end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
256 257 258 |
# File 'lib/cfoundry/v2/app.rb', line 256 def app @app end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
256 257 258 |
# File 'lib/cfoundry/v2/app.rb', line 256 def id @id end |
Instance Method Details
#console ⇒ Object
286 287 288 289 290 291 292 |
# File 'lib/cfoundry/v2/app.rb', line 286 def console return unless @manifest[:console_ip] and @manifest[:console_port] { :ip => @manifest[:console_ip], :port => @manifest[:console_port] } end |
#debugger ⇒ Object
278 279 280 281 282 283 284 |
# File 'lib/cfoundry/v2/app.rb', line 278 def debugger return unless @manifest[:debug_ip] and @manifest[:debug_port] { :ip => @manifest[:debug_ip], :port => @manifest[:debug_port] } end |
#file(*path) ⇒ Object
309 310 311 |
# File 'lib/cfoundry/v2/app.rb', line 309 def file(*path) @client.base.files(@app.guid, @id, *path) end |
#files(*path) ⇒ Object
303 304 305 306 307 |
# File 'lib/cfoundry/v2/app.rb', line 303 def files(*path) @client.base.files(@app.guid, @id, *path).split("\n").collect do |entry| path + [entry.split(/\s+/, 2)[0]] end end |
#healthy? ⇒ Boolean
294 295 296 297 298 299 300 301 |
# File 'lib/cfoundry/v2/app.rb', line 294 def healthy? case state when "STARTING", "RUNNING" true when "DOWN", "FLAPPING" false end end |
#inspect ⇒ Object
265 266 267 |
# File 'lib/cfoundry/v2/app.rb', line 265 def inspect "#<App::Instance '#{@app.name}' \##@id>" end |
#since ⇒ Object
274 275 276 |
# File 'lib/cfoundry/v2/app.rb', line 274 def since Time.at(@manifest[:since]) end |
#state ⇒ Object Also known as: status
269 270 271 |
# File 'lib/cfoundry/v2/app.rb', line 269 def state @manifest[:state] end |