Class: PhidgetRfid::Commands

Inherits:
Object
  • Object
show all
Extended by:
CLI::Task
Defined in:
lib/phidget_rfid/commands.rb

Instance Method Summary collapse

Constructor Details

#initialize(r) ⇒ Commands

Returns a new instance of Commands.



14
15
16
# File 'lib/phidget_rfid/commands.rb', line 14

def initialize (r)
  @rfid_handler = r
end

Instance Method Details

#clear(params) ⇒ Object



58
59
60
# File 'lib/phidget_rfid/commands.rb', line 58

def clear(params)
  system "clear" or system "cls"
end

#device(params) ⇒ Object



65
66
67
# File 'lib/phidget_rfid/commands.rb', line 65

def device(params)
  puts @rfid_handler.device
end

#log(params) ⇒ Object



72
73
74
# File 'lib/phidget_rfid/commands.rb', line 72

def log(params)
  puts @rfid_handler.log
end

#protocol(params) ⇒ Object



49
50
51
# File 'lib/phidget_rfid/commands.rb', line 49

def protocol(params)
    puts @rfid_handler.protocol
end

#read(params) ⇒ Object



22
23
24
# File 'lib/phidget_rfid/commands.rb', line 22

def read(params)
    puts @rfid_handler.read
end

#write(params) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/phidget_rfid/commands.rb', line 32

def write(params)
    
    if params.size == 1
        puts @rfid_handler.write params[0]
    elsif params.size == 2
        puts @rfid_handler.write params[0], params[1]
    elsif params.size == 3
        
        puts  @rfid_handler.write params[0], params[2], params[3]
    end
end