Class: Galaxy::Slot
- Inherits:
-
Object
- Object
- Galaxy::Slot
- Defined in:
- lib/galaxy.rb
Overview
Slot Information
Instance Attribute Summary collapse
-
#binary ⇒ Object
readonly
Returns the value of attribute binary.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#short_id ⇒ Object
readonly
Returns the value of attribute short_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#status_message ⇒ Object
readonly
Returns the value of attribute status_message.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #columns(colors = false) ⇒ Object
-
#initialize(uuid, short_id, url, binary, config, status, status_message, path) ⇒ Slot
constructor
A new instance of Slot.
Constructor Details
#initialize(uuid, short_id, url, binary, config, status, status_message, path) ⇒ Slot
Returns a new instance of Slot.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/galaxy.rb', line 41 def initialize(uuid, short_id, url, binary, config, status, , path) @uuid = uuid @short_id = short_id @url = url @binary = binary @config = config @status = status @status_message = @path = path unless url.nil? @host = URI.parse(url).host unless url.nil? @ip = IPSocket::getaddress(host) end @host ||= "unknown" @ip ||= "unknown" end |
Instance Attribute Details
#binary ⇒ Object (readonly)
Returns the value of attribute binary.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def binary @binary end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def config @config end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def host @host end |
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def ip @ip end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def path @path end |
#short_id ⇒ Object (readonly)
Returns the value of attribute short_id.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def short_id @short_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def status @status end |
#status_message ⇒ Object (readonly)
Returns the value of attribute status_message.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def @status_message end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def url @url end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
39 40 41 |
# File 'lib/galaxy.rb', line 39 def uuid @uuid end |
Instance Method Details
#columns(colors = false) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/galaxy.rb', line 60 def columns(colors = false) status = @status = @status_message if colors status = case status when "RUNNING" then Colorize::colorize(status, :bright, :green) when "STOPPED" then status else status end = Colorize::colorize(, :red) end return [@short_id, @host, status, @binary, @config, ].map { |value| value || '' } end |