Class: Volay::Utils
- Inherits:
-
Object
- Object
- Volay::Utils
- Defined in:
- lib/volay/utils.rb
Overview
Utils class
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
-
#initialize(app) ⇒ Utils
constructor
Initialize utils class.
- #status_icon ⇒ Object
-
#update_status_icon ⇒ Object
Change status icon stock.
Constructor Details
#initialize(app) ⇒ Utils
Initialize utils class
14 15 16 |
# File 'lib/volay/utils.rb', line 14 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
7 8 9 |
# File 'lib/volay/utils.rb', line 7 def app @app end |
Instance Method Details
#status_icon ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/volay/utils.rb', line 30 def status_icon 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 end |
#update_status_icon ⇒ Object
Change status icon stock
21 22 23 24 25 26 27 28 |
# File 'lib/volay/utils.rb', line 21 def update_status_icon icon = status_icon @app.get_object('status_icon') .set_stock(icon) @app.get_object('toggle_mute').set_active(@app.mixer.muted?) @app.get_object('toggle_mute_image') .set_stock(icon) end |