Module: Mindset
- Defined in:
- lib/mindset.rb
Overview
Defined Under Namespace
Classes: Connection, LoopbackConnection, Packet, PacketStore
Class Method Summary collapse
-
.connect(device, verbose = false, &block) ⇒ Object
Return a Mindset::Connection object for device.
Class Method Details
.connect(device, verbose = false, &block) ⇒ Object
Return a Mindset::Connection object for device. If a block is provided, this yields the Connection object, then disconnects it when the block returns.
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/mindset.rb', line 302 def self.connect(device, verbose=false, &block) $stderr.puts "CONNECT #{device}, #{MINDSET_BAUD}" if verbose begin conn = Connection.new device if block_given? yield conn conn.disconnect else return conn end rescue TypeError => e $stderr.puts "Could not connect to #{device}: #{e.message}" end nil end |