Class: Component
- Inherits:
-
Object
- Object
- Component
- Defined in:
- lib/panda_motd/component.rb
Direct Known Subclasses
ASCIITextArt, Fail2Ban, Filesystems, LastLogin, SSLCertificates, ServiceStatus, Uptime
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#initialize(motd, name) ⇒ Component
constructor
A new instance of Component.
-
#lines_after ⇒ Object
The number of lines to print after the component in the context of the entire MOTD.
-
#lines_before ⇒ Object
The number of lines to print before the component in the context of the entire MOTD.
-
#process ⇒ Object
Evaluates the component so that it has some meaningful output when it comes time to print the MOTD.
-
#to_s ⇒ Object
Gives the output of a component as a string.
Constructor Details
#initialize(motd, name) ⇒ Component
Returns a new instance of Component.
6 7 8 9 10 11 |
# File 'lib/panda_motd/component.rb', line 6 def initialize(motd, name) @name = name @motd = motd @config = motd.config.component_config(@name) @errors = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/panda_motd/component.rb', line 4 def config @config end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/panda_motd/component.rb', line 4 def errors @errors end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/panda_motd/component.rb', line 4 def name @name end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
4 5 6 |
# File 'lib/panda_motd/component.rb', line 4 def results @results end |
Instance Method Details
#lines_after ⇒ Object
The number of lines to print after the component in the context of the entire MOTD. 1 by default, if not configured.
32 33 34 |
# File 'lib/panda_motd/component.rb', line 32 def lines_after @motd.config.component_config(@name)["lines_after"] || 1 end |
#lines_before ⇒ Object
The number of lines to print before the component in the context of the entire MOTD. 1 by default, if not configured.
26 27 28 |
# File 'lib/panda_motd/component.rb', line 26 def lines_before @motd.config.component_config(@name)["lines_before"] || 1 end |
#process ⇒ Object
Evaluates the component so that it has some meaningful output when it comes time to print the MOTD.
15 16 17 |
# File 'lib/panda_motd/component.rb', line 15 def process raise NotImplementedError end |
#to_s ⇒ Object
Gives the output of a component as a string.
20 21 22 |
# File 'lib/panda_motd/component.rb', line 20 def to_s raise NotImplementedError end |