Class: PrologixGpib::CLI
- Inherits:
-
Thor
- Object
- Thor
- PrologixGpib::CLI
- Defined in:
- lib/prologix_gpib/cli.rb
Instance Method Summary collapse
- #info(index) ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #list ⇒ Object
Constructor Details
#initialize(*args) ⇒ CLI
Returns a new instance of CLI.
9 10 11 12 |
# File 'lib/prologix_gpib/cli.rb', line 9 def initialize(*args) super @controllers = PrologixGpib::Finder.new.avaliable_controllers end |
Instance Method Details
#info(index) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/prologix_gpib/cli.rb', line 22 def info(index) return unless controllers_connected? controller_paths = @controllers.map { |k, v| v }.flatten path = controller_paths[index.to_i] hash = ip_address?(path) ? PrologixGpib::LanController.new(path).config : PrologixGpib::UsbController.new(path).config puts "\n #{titleise hash.delete(:device_name)}" puts "\tPath: #{path}" hash.each { |k, v| puts "\t#{titleise(k)}: #{v}" } end |
#list ⇒ Object
16 17 18 |
# File 'lib/prologix_gpib/cli.rb', line 16 def list puts controller_table(@controllers) end |