Class: Battery

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/battery/battery.rb,
lib/battery/version.rb

Constant Summary collapse

VERSION =
'1.0.0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Battery

Returns a new instance of Battery.



11
12
13
# File 'lib/battery/battery.rb', line 11

def initialize( options = {} )
  self.data_source = options[:data_source] || UPowerDataSource.new
end

Instance Attribute Details

#data_sourceObject

Returns the value of attribute data_source.



9
10
11
# File 'lib/battery/battery.rb', line 9

def data_source
  @data_source
end

Instance Method Details

#updateObject



32
33
34
35
# File 'lib/battery/battery.rb', line 32

def update
  data_source.update
  self
end