Class: Brick

Inherits:
Object
  • Object
show all
Defined in:
lib/brick.rb

Overview

Abstract parent class of motor and sensor bricks. Currently provides only very basic common functionality but may be expanded in the future.

Direct Known Subclasses

Motor, Sensor

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nxt, port) ⇒ Brick

Returns a new instance of Brick.



31
32
33
34
35
36
37
38
39
40
# File 'lib/brick.rb', line 31

def initialize(nxt, port)
  logfile = File.expand_path(File.dirname(File.expand_path(__FILE__)))+"/../log/#{self.class}_#{port}.log"
  @log = Logger.new logfile
  @log.level = Logger::DEBUG
  #puts "Logging to #{logfile}"

  debug("#{self.class}::#{nxt}(#{port})", :initialize)

  @nxt = nxt
end

Instance Attribute Details

#logObject (readonly)

Returns the value of attribute log.



29
30
31
# File 'lib/brick.rb', line 29

def log
  @log
end

#portObject (readonly)

Returns the value of attribute port.



28
29
30
# File 'lib/brick.rb', line 28

def port
  @port
end