Class: Cmdlib::Describe

Inherits:
Object
  • Object
show all
Defined in:
lib/cmdlib/describe.rb

Overview

Create class with describe information of any objects.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDescribe

Returns a new instance of Describe.



21
22
23
24
25
26
27
# File 'lib/cmdlib/describe.rb', line 21

def initialize
  @oname = ''
  @brief = ''
  @details = []
  @example = []
  @options = []
end

Instance Attribute Details

#briefObject

This string have should text with brief information.



10
11
12
# File 'lib/cmdlib/describe.rb', line 10

def brief
  @brief
end

#detailsObject

This array string have should text with details information.



13
14
15
# File 'lib/cmdlib/describe.rb', line 13

def details
  @details
end

#exampleObject

This array string have should text with examples information.



16
17
18
# File 'lib/cmdlib/describe.rb', line 16

def example
  @example
end

#onameObject

This string have should text with object name.



7
8
9
# File 'lib/cmdlib/describe.rb', line 7

def oname
  @oname
end

#optionsObject

This array string have should text with tags information.



19
20
21
# File 'lib/cmdlib/describe.rb', line 19

def options
  @options
end

Class Method Details

.outtitle(str) ⇒ Object

Display title in follow format: *** [title] ***.



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cmdlib/describe.rb', line 30

def self.outtitle ( str )
  if( str.length < (80-4) ) then
	borderlen = 80 - str.length - 4
	print '*' * (borderlen/2)
	print '[ '
	print str
	print ' ]'
	puts '*' * (borderlen/2)
  else
	puts str
  end
end

Instance Method Details

#displayObject

Display all information about object.



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/cmdlib/describe.rb', line 44

def display
  puts
  Describe.outtitle( @oname )
  puts
  puts ' ' + @brief
  puts
  puts '** DESCRIBE:'
  @details.each do |line|
	puts ' ' + line
  end
  puts
  puts '** EXAMPLE:'
  @example.each do |line|
	puts ' ' + line
  end
  puts
end