Class: Sensors::Subfeature
- Inherits:
-
Object
- Object
- Sensors::Subfeature
- Defined in:
- lib/sensors/subfeature.rb
Instance Attribute Summary collapse
-
#chip ⇒ Object
readonly
Returns the value of attribute chip.
Instance Method Summary collapse
-
#initialize(feature, pointer) ⇒ Subfeature
constructor
A new instance of Subfeature.
- #to_ffi ⇒ Object
- #value ⇒ Object
- #value=(value) ⇒ Object
Constructor Details
#initialize(feature, pointer) ⇒ Subfeature
Returns a new instance of Subfeature.
34 35 36 37 38 |
# File 'lib/sensors/subfeature.rb', line 34 def initialize (feature, pointer) @chip = feature.chip @feature = feature @value = pointer.is_a?(C::Subfeature) ? pointer : C::Subfeature.new(pointer) end |
Instance Attribute Details
#chip ⇒ Object (readonly)
Returns the value of attribute chip.
32 33 34 |
# File 'lib/sensors/subfeature.rb', line 32 def chip @chip end |
Instance Method Details
#to_ffi ⇒ Object
60 61 62 |
# File 'lib/sensors/subfeature.rb', line 60 def to_ffi number end |
#value ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/sensors/subfeature.rb', line 46 def value FFI::MemoryPointer.new(:double).tap {|result| C::sensors_get_value(chip.to_ffi, to_ffi, result) break result.typecast(:double) } end |
#value=(value) ⇒ Object
54 55 56 |
# File 'lib/sensors/subfeature.rb', line 54 def value= (value) C::sensors_set_value(chip.to_ffi, to_ffi, value) end |