Class: Raudi::Processing::Base

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

Direct Known Subclasses

GPIO, Int, PCInt, Timer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, source) ⇒ Base

Returns a new instance of Base.



23
24
25
26
# File 'lib/raudi/processing.rb', line 23

def initialize(controller, source)
  self.controller = controller
  self.source = source
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object



38
39
40
41
42
43
# File 'lib/raudi/processing.rb', line 38

def method_missing(method_name, *args, &block)
  [source, controller].each do |delegate|
    return delegate.send(method_name, *args, &block) if delegate.respond_to?(method_name)
  end
  super
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



17
18
19
# File 'lib/raudi/processing.rb', line 17

def controller
  @controller
end

#sourceObject

Returns the value of attribute source.



17
18
19
# File 'lib/raudi/processing.rb', line 17

def source
  @source
end

Class Method Details

.inherited(klass) ⇒ Object



19
20
21
# File 'lib/raudi/processing.rb', line 19

def self.inherited(klass)
  Processing.list << klass
end

Instance Method Details

#generate_configObject



33
34
35
36
# File 'lib/raudi/processing.rb', line 33

def generate_config
  return unless can_process?
  config
end

#generate_interruptsObject



28
29
30
31
# File 'lib/raudi/processing.rb', line 28

def generate_interrupts
  return unless can_process?
  interrupts
end