class TFClient::TFPrompt

Attributes

mass[W]
operator[R]
shield_charge[W]
status_report[R]
warp_charge[W]
x[W]
y[W]

Public Class Methods

new(operator:, status_report:) click to toggle source
# File lib/textflight-client/tfprompt.rb, line 10
def initialize(operator:, status_report:)
  @operator = operator
  @status_report = status_report
  @mass = status_report.hash[:mass].to_i
  @warp_charge = status_report.hash[:warp_charge]
  @shield_charge = status_report.hash[:shield]
end

Public Instance Methods

shield_percent() click to toggle source
# File lib/textflight-client/tfprompt.rb, line 26
def shield_percent
  ((@shield_charge.to_f/@mass.to_i) * 100).to_i
end
to_s() click to toggle source
# File lib/textflight-client/tfprompt.rb, line 18
def to_s
  "S: #{shield_percent}% Ms: #{@mass} Wrp: #{warp_percent}% (#{@x},#{@y}) #{operator} > "
end
warp_percent() click to toggle source
# File lib/textflight-client/tfprompt.rb, line 22
def warp_percent
  ((@warp_charge.to_f/@mass.to_i) * 100).to_i
end