Class: Dommy::BatteryManager
- Inherits:
-
Object
- Object
- Dommy::BatteryManager
- Includes:
- EventTarget
- Defined in:
- lib/dommy/navigator.rb
Overview
‘navigator.getBattery()` returns one of these. Fixed snapshot —tests that need different values can stub.
Instance Attribute Summary collapse
-
#charging ⇒ Object
readonly
Returns the value of attribute charging.
-
#charging_time ⇒ Object
readonly
Returns the value of attribute charging_time.
-
#discharging_time ⇒ Object
readonly
Returns the value of attribute discharging_time.
-
#level ⇒ Object
readonly
Returns the value of attribute level.
Instance Method Summary collapse
- #__event_parent__ ⇒ Object
- #__js_get__(key) ⇒ Object
-
#initialize(charging: true, level: 1.0, charging_time: 0, discharging_time: Float::INFINITY) ⇒ BatteryManager
constructor
A new instance of BatteryManager.
Methods included from EventTarget
#__deliver_event__, #add_event_listener, #dispatch_event, #invoke_listener, #remove_event_listener
Constructor Details
#initialize(charging: true, level: 1.0, charging_time: 0, discharging_time: Float::INFINITY) ⇒ BatteryManager
Returns a new instance of BatteryManager.
501 502 503 504 505 506 |
# File 'lib/dommy/navigator.rb', line 501 def initialize(charging: true, level: 1.0, charging_time: 0, discharging_time: Float::INFINITY) @charging = charging @level = level @charging_time = charging_time @discharging_time = discharging_time end |
Instance Attribute Details
#charging ⇒ Object (readonly)
Returns the value of attribute charging.
499 500 501 |
# File 'lib/dommy/navigator.rb', line 499 def charging @charging end |
#charging_time ⇒ Object (readonly)
Returns the value of attribute charging_time.
499 500 501 |
# File 'lib/dommy/navigator.rb', line 499 def charging_time @charging_time end |
#discharging_time ⇒ Object (readonly)
Returns the value of attribute discharging_time.
499 500 501 |
# File 'lib/dommy/navigator.rb', line 499 def discharging_time @discharging_time end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
499 500 501 |
# File 'lib/dommy/navigator.rb', line 499 def level @level end |
Instance Method Details
#__event_parent__ ⇒ Object
521 522 523 |
# File 'lib/dommy/navigator.rb', line 521 def __event_parent__ nil end |
#__js_get__(key) ⇒ Object
508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/dommy/navigator.rb', line 508 def __js_get__(key) case key when "charging" @charging when "chargingTime" @charging_time when "dischargingTime" @discharging_time when "level" @level end end |