Class: MotherBrain::Gear::Base
- Inherits:
-
Object
- Object
- MotherBrain::Gear::Base
- Includes:
- VariaModel
- Defined in:
- lib/mb/gear.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.keyword ⇒ Symbol
readonly
The identifier for the Gear.
Class Method Summary collapse
-
.register_gear(keyword) ⇒ Object
Register the gear with MotherBrain::Gear with the given keyword.
Instance Method Summary collapse
Class Attribute Details
.keyword ⇒ Symbol (readonly)
The identifier for the Gear. The keyword is automatically populated based on the name of the Class including MotherBrain::Gear. The keyword must be unique among the other registered Gears. Also used to define a Gear in the plugin DSL.
31 32 33 |
# File 'lib/mb/gear.rb', line 31 def keyword @keyword end |
Class Method Details
.register_gear(keyword) ⇒ Object
Register the gear with MotherBrain::Gear with the given keyword. This is how a gear is identified within a plugin.
37 38 39 40 |
# File 'lib/mb/gear.rb', line 37 def register_gear(keyword) @keyword = keyword.to_sym Gear.register(self) end |
Instance Method Details
#run(job, environment, *args) ⇒ Object
49 50 51 |
# File 'lib/mb/gear.rb', line 49 def run(job, environment, *args) raise AbstractFunction, "#run(environment, *args) must be implemented on #{self.class}" end |