Class: PiDriver::Pin::FileHelper
- Inherits:
-
Object
- Object
- PiDriver::Pin::FileHelper
- Defined in:
- lib/pi_driver/pin/file_helper.rb
Instance Method Summary collapse
-
#initialize(gpio_number) ⇒ FileHelper
constructor
A new instance of FileHelper.
- #read_value ⇒ Object
- #write_direction(direction) ⇒ Object
- #write_export ⇒ Object
- #write_value(value) ⇒ Object
Constructor Details
#initialize(gpio_number) ⇒ FileHelper
Returns a new instance of FileHelper.
6 7 8 9 |
# File 'lib/pi_driver/pin/file_helper.rb', line 6 def initialize(gpio_number) @gpio_number = gpio_number @directory_helper = DirectoryHelper.new @gpio_number end |
Instance Method Details
#read_value ⇒ Object
11 12 13 |
# File 'lib/pi_driver/pin/file_helper.rb', line 11 def read_value File.read(@directory_helper.value).to_i end |
#write_direction(direction) ⇒ Object
15 16 17 |
# File 'lib/pi_driver/pin/file_helper.rb', line 15 def write_direction(direction) File.write(@directory_helper.direction, direction) end |
#write_export ⇒ Object
19 20 21 |
# File 'lib/pi_driver/pin/file_helper.rb', line 19 def write_export File.write(@directory_helper.export, @gpio_number) end |
#write_value(value) ⇒ Object
23 24 25 |
# File 'lib/pi_driver/pin/file_helper.rb', line 23 def write_value(value) File.write(@directory_helper.value, value) end |