Class: Dino::Components::BaseComponent
- Inherits:
-
Object
- Object
- Dino::Components::BaseComponent
- Defined in:
- lib/dino/components/base_component.rb
Instance Attribute Summary collapse
-
#board ⇒ Object
readonly
Returns the value of attribute board.
-
#pin ⇒ Object
(also: #pins)
readonly
Returns the value of attribute pin.
-
#pullup ⇒ Object
readonly
Returns the value of attribute pullup.
Instance Method Summary collapse
-
#after_initialize(options = {}) ⇒ Object
As BaseComponent does a lot of work for you with regarding to setting up, it is best not to override #initialize and instead define an #after_initialize method within your subclass.
-
#initialize(options = {}) ⇒ BaseComponent
constructor
A new instance of BaseComponent.
Constructor Details
#initialize(options = {}) ⇒ BaseComponent
Returns a new instance of BaseComponent.
7 8 9 10 11 12 13 14 |
# File 'lib/dino/components/base_component.rb', line 7 def initialize(={}) self.board = [:board] self.pin = [:pin] || [:pins] self.pullup = [:pullup] raise 'board and pin or pins are required for a component' if self.board.nil? || self.pin.nil? after_initialize() end |
Instance Attribute Details
#board ⇒ Object
Returns the value of attribute board.
4 5 6 |
# File 'lib/dino/components/base_component.rb', line 4 def board @board end |
#pin ⇒ Object Also known as: pins
Returns the value of attribute pin.
4 5 6 |
# File 'lib/dino/components/base_component.rb', line 4 def pin @pin end |
#pullup ⇒ Object
Returns the value of attribute pullup.
4 5 6 |
# File 'lib/dino/components/base_component.rb', line 4 def pullup @pullup end |
Instance Method Details
#after_initialize(options = {}) ⇒ Object
Note:
This method should be implemented in the BaseComponent subclass.
As BaseComponent does a lot of work for you with regarding to setting up, it is best not to override #initialize and instead define an #after_initialize method within your subclass.
23 |
# File 'lib/dino/components/base_component.rb', line 23 def after_initialize(={}) ; end |