Class: Consular::Core

Inherits:
Object
  • Object
show all
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)

Class Method Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Core) initialize(path)

Instantiated the hash from the Termfile into the core.

Parameters:

  • path (String)

    Path to Termfile



19
20
21
# File 'lib/consular/core.rb', line 19

def initialize(path)
  @termfile = Consular::DSL.new(path).to_hash
end

Instance Attribute Details

- (Object) termfile

Returns the value of attribute termfile



10
11
12
# File 'lib/consular/core.rb', line 10

def termfile
  @termfile
end

Class Method Details

+ (Hash) capture!

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.

Returns:

  • (Hash)

    Consular style hash.

Raises:

  • (NotImplementedError)


59
60
61
# File 'lib/consular/core.rb', line 59

def capture!
  raise NotImplementedError, "capture! is currently unavailable for this core."
end

+ (Boolean) valid_system?

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.

Returns:

  • (Boolean)

    Whether the current system is valid.

Raises:

  • (NotImplementedError)


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

- (Object) process!

Method called by the runner to execute the Termfile on the core.

Raises:

  • (NotImplementedError)


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

- (Object) setup!

Method called by runner to execute the Termfile setup on the core.

Raises:

  • (NotImplementedError)


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