Module: LegoEv3
- Defined in:
- lib/brick.rb,
lib/utilities.rb,
lib/exceptions.rb,
lib/tacho_motor.rb,
lib/sensors/base.rb,
lib/sensors/touch.rb,
lib/connection/base.rb,
lib/commands/builder.rb,
lib/connection/local.rb,
lib/connection/remote.rb,
lib/connection/upload.rb,
lib/connection/connection.rb
Defined Under Namespace
Modules: Commands Classes: BaseConnection, Brick, Connection, LegoSensor, LocalConnection, RemoteConnection, RemoteConnectionException, TachoMotor, TouchSensor, Uploader
Class Method Summary collapse
- .default_user_config ⇒ Object
- .load_config(path) ⇒ Object
-
.with_timer(&block) ⇒ Object
bar, time = with_timer do foo() end.
Class Method Details
.default_user_config ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/utilities.rb', line 19 def self.default_user_config { 'ssh' => { 'host' => '192.168.2.3', # I'm working on Mac OS X, eh. 'hostname' => 'ev3dev', 'username' => 'root', 'password' => 'r00tme' } } end |
.load_config(path) ⇒ Object
30 31 32 |
# File 'lib/utilities.rb', line 30 def self.load_config(path) YAML::load(File.open(path)) end |
.with_timer(&block) ⇒ Object
bar, time = with_timer do
foo()
end
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/utilities.rb', line 8 def self.with_timer(&block) start = Time.now return_value = block.call finish = Time.now diff = finish - start [return_value, (diff * 1000).to_i] # in ms. end |