lib/volay/utils.rb in volay-1.1.0 vs lib/volay/utils.rb in volay-1.2.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + # Volay module module Volay # Utils class class Utils attr_reader :app @@ -24,20 +26,16 @@ @app.get_object('toggle_mute_image') .set_stock(icon) end def status_icon - unless @app.mixer.muted? - case @app.mixer.percent - when 66..100 - icon = 'volume-high' - when 33..65 - icon = 'volume-medium' - when 0..32 - icon = 'volume-low' - end + return 'volume-muted' if @app.mixer.muted? + if (66..100).cover?(@app.mixer.percent) + 'volume-high' + elsif (33..65).cover?(@app.mixer.percent) + 'volume-medium' + else + 'volume-low' end - - icon.nil? ? 'volume-muted' : icon end end end