Class: Controllers

Inherits:
Object show all
Defined in:
lib/rubimc/controllers.rb

Overview

ToDo: rename Controllers to MCUs

Direct Known Subclasses

AVRController

Constant Summary collapse

@@controllers_array =
[]

Class Method Summary collapse

Class Method Details

.allObject

list of USER`s microcontrolles



3
4
5
# File 'lib/rubimc/controllers.rb', line 3

def self.all # list of USER`s microcontrolles
  @@controllers_array
end

.find_mcu(name) ⇒ Object



16
17
18
19
20
21
# File 'lib/rubimc/controllers.rb', line 16

def self.find_mcu(name)
  series_array = Controllers.descendants
  real_mcu_array = []
  series_array.each {|series| real_mcu_array += series.descendants}
  return real_mcu_array.select {|mcu| mcu.is_real_controller? and mcu::MCU_NAME == name}
end

.inherited(child_class) ⇒ Object

hook when define class



8
9
10
# File 'lib/rubimc/controllers.rb', line 8

def self.inherited(child_class) # hook when define class
  @@controllers_array << child_class if child_class.is_real_controller?
end

.is_real_controller?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/rubimc/controllers.rb', line 12

def self.is_real_controller?
  false
end