class UdooNeoRest::ValidatePin
Validate
the Pin parameter
value : the pin value to be validated
Public Class Methods
new(value)
click to toggle source
# File lib/udooneorest/validators.rb, line 89 def initialize(value) @value = value.to_i @error_message = nil valid? end
Public Instance Methods
to_gpio()
click to toggle source
Convert a PIN reference to a GPIO reference as all the commands use GPIO
# File lib/udooneorest/validators.rb, line 108 def to_gpio return nil unless valid? GPIOS[@value] end
valid?()
click to toggle source
# File lib/udooneorest/validators.rb, line 95 def valid? if (@value > 47) || (GPIOS[@value] == 'NA') @error_message = UdooNeoRest::Base.status_error("Pin value of #{@value} is invalid. Please refer to UDOO Neo documentation.") return false end @error_message = nil true end