Class: Consular::Core
- Inherits:
-
Object
- Object
- Consular::Core
- Defined in:
- lib/consular/core.rb
Overview
Defines the abstract definition of a core. This needs to be subclassed and have the appropriate methods defined so that the CLI runner knows how to execute the Termfile on each core. You will need to add the core to Consular like so:
Consular.add_core self
Instance Attribute Summary collapse
-
#termfile ⇒ Object
Returns the value of attribute termfile.
Class Method Summary collapse
-
.capture! ⇒ Hash
Captures the current terminal settings for the system.
-
.valid_system? ⇒ Boolean
Checks to see if the current system/terminal is the right one to use for this core.
Instance Method Summary collapse
-
#initialize(path) ⇒ Core
constructor
Instantiated the hash from the Termfile into the core.
-
#process! ⇒ Object
Method called by the runner to execute the Termfile on the core.
-
#setup! ⇒ Object
Method called by runner to execute the Termfile setup on the core.
Constructor Details
#initialize(path) ⇒ Core
Instantiated the hash from the Termfile into the core.
19 20 21 |
# File 'lib/consular/core.rb', line 19 def initialize(path) @termfile = Consular::DSL.new(path).to_hash end |
Instance Attribute Details
#termfile ⇒ Object
Returns the value of attribute termfile.
10 11 12 |
# File 'lib/consular/core.rb', line 10 def termfile @termfile end |
Class Method Details
.capture! ⇒ Hash
Captures the current terminal settings for the system. It will return a hash format like that of Consular::DSL so that Consular can write it back out into a Termfile.
59 60 61 |
# File 'lib/consular/core.rb', line 59 def capture! raise NotImplementedError, "capture! is currently unavailable for this core." end |
.valid_system? ⇒ Boolean
Checks to see if the current system/terminal is the right one to use for this core. This is called by the CLI to check if a particular core should be used.
48 49 50 |
# File 'lib/consular/core.rb', line 48 def valid_system? raise NotImplementedError, ".valid_system? needs to be defined for Consular to determine what system is belongs to." end |
Instance Method Details
#process! ⇒ Object
Method called by the runner to execute the Termfile on the core.
36 37 38 |
# File 'lib/consular/core.rb', line 36 def process! raise NotImplementedError, ".process! needs to be defined for it to be ran by `consular start`" end |
#setup! ⇒ Object
Method called by runner to execute the Termfile setup on the core.
28 29 30 |
# File 'lib/consular/core.rb', line 28 def setup! raise NotImplementedError, ".setup! needs to be defined for it to be ran by `consular setup`" end |