Class: Raudi::AVR::Controller
- Inherits:
-
Object
- Object
- Raudi::AVR::Controller
- Extended by:
- Forwardable
- Includes:
- StateList
- Defined in:
- lib/raudi/avr/controller.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#interrupt ⇒ Object
Returns the value of attribute interrupt.
-
#model_name ⇒ Object
Returns the value of attribute model_name.
-
#ports(port_name = nil) ⇒ Object
Returns the value of attribute ports.
-
#timers ⇒ Object
Returns the value of attribute timers.
Instance Method Summary collapse
-
#initialize(model_name, &block) ⇒ Controller
constructor
A new instance of Controller.
- #pins ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(model_name, &block) ⇒ Controller
Returns a new instance of Controller.
18 19 20 21 22 23 24 25 |
# File 'lib/raudi/avr/controller.rb', line 18 def initialize(model_name, &block) self.model_name = model_name load_ports load_timers self.headers = ['avr/io'] Proxy::Controller.new(self, &block) if block_given? Raudi.controller = self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
61 62 63 64 65 66 67 |
# File 'lib/raudi/avr/controller.rb', line 61 def method_missing(method_name, *args, &block) if value = config[method_name.to_s] value else super end end |
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
14 15 16 |
# File 'lib/raudi/avr/controller.rb', line 14 def headers @headers end |
#interrupt ⇒ Object
Returns the value of attribute interrupt.
14 15 16 |
# File 'lib/raudi/avr/controller.rb', line 14 def interrupt @interrupt end |
#model_name ⇒ Object
Returns the value of attribute model_name.
14 15 16 |
# File 'lib/raudi/avr/controller.rb', line 14 def model_name @model_name end |
#ports(port_name = nil) ⇒ Object
Returns the value of attribute ports.
14 15 16 |
# File 'lib/raudi/avr/controller.rb', line 14 def ports @ports end |
#timers ⇒ Object
Returns the value of attribute timers.
14 15 16 |
# File 'lib/raudi/avr/controller.rb', line 14 def timers @timers end |
Instance Method Details
#pins ⇒ Object
35 36 37 |
# File 'lib/raudi/avr/controller.rb', line 35 def pins ports.map(&:pins).flatten end |
#source ⇒ Object
39 40 41 |
# File 'lib/raudi/avr/controller.rb', line 39 def source @source ||= Source::Controller.new(self) end |