class Ev3dev::Device
Attributes
device_path[R]
Public Class Methods
new(device_path)
click to toggle source
# File lib/ev3dev/device.rb, line 5 def initialize(device_path) @device_path = device_path end
Public Instance Methods
method_missing(name, *args, &block)
click to toggle source
# File lib/ev3dev/device.rb, line 9 def method_missing(name, *args, &block) raise "no device connected" if @device_path.nil? param = File.join @device_path, name.to_s raise "no such attribute: #{param}" unless File.exist? param if args.first.nil? IO.read(param).strip else IO.write param, args.first.to_s self end end