Class: Component

Inherits:
Object
  • Object
show all
Defined in:
lib/panda_motd/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(motd, name) ⇒ Component

Returns a new instance of Component.



4
5
6
7
8
9
# File 'lib/panda_motd/component.rb', line 4

def initialize(motd, name)
  @name = name
  @motd = motd
  @config = motd.config.component_config(@name)
  @errors = []
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



2
3
4
# File 'lib/panda_motd/component.rb', line 2

def config
  @config
end

#errorsObject (readonly)

Returns the value of attribute errors.



2
3
4
# File 'lib/panda_motd/component.rb', line 2

def errors
  @errors
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/panda_motd/component.rb', line 2

def name
  @name
end

#resultsObject (readonly)

Returns the value of attribute results.



2
3
4
# File 'lib/panda_motd/component.rb', line 2

def results
  @results
end

Instance Method Details

#lines_afterObject



23
24
25
# File 'lib/panda_motd/component.rb', line 23

def lines_after
  @motd.config.component_config(@name)['lines_after'] || 1
end

#lines_beforeObject



19
20
21
# File 'lib/panda_motd/component.rb', line 19

def lines_before
  @motd.config.component_config(@name)['lines_before'] || 1
end

#processObject

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/panda_motd/component.rb', line 11

def process
  raise NotImplementedError
end

#to_sObject

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/panda_motd/component.rb', line 15

def to_s
  raise NotImplementedError
end