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
- #__internal_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
#__internal_deliver_event__, #add_event_listener, capture_flag, #deliver_at, #dispatch_event, js_truthy?, #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.
511 512 513 514 515 516 |
# File 'lib/dommy/navigator.rb', line 511 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.
509 510 511 |
# File 'lib/dommy/navigator.rb', line 509 def charging @charging end |
#charging_time ⇒ Object (readonly)
Returns the value of attribute charging_time.
509 510 511 |
# File 'lib/dommy/navigator.rb', line 509 def charging_time @charging_time end |
#discharging_time ⇒ Object (readonly)
Returns the value of attribute discharging_time.
509 510 511 |
# File 'lib/dommy/navigator.rb', line 509 def discharging_time @discharging_time end |
#level ⇒ Object (readonly)
Returns the value of attribute level.
509 510 511 |
# File 'lib/dommy/navigator.rb', line 509 def level @level end |
Instance Method Details
#__internal_event_parent__ ⇒ Object
531 532 533 |
# File 'lib/dommy/navigator.rb', line 531 def __internal_event_parent__ nil end |
#__js_get__(key) ⇒ Object
518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/dommy/navigator.rb', line 518 def __js_get__(key) case key when "charging" @charging when "chargingTime" @charging_time when "dischargingTime" @discharging_time when "level" @level end end |