Method: Twterm::Image.remaining_resource
- Defined in:
- lib/twterm/image.rb
.remaining_resource(remaining, total, length) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/twterm/image.rb', line 78 def self.remaining_resource(remaining, total, length) ratio = remaining * 100 / total color = if ratio >= 40 :green elsif ratio >= 20 :yellow else :red end = string(('|' * (remaining * length / total)).ljust(length)).color(color) Between.new(, !string('['), !string(']')) end |