Class: Cmdlib::Describe
- Inherits:
-
Object
- Object
- Cmdlib::Describe
- Defined in:
- lib/cmdlib/describe.rb
Overview
Create class with describe information of any objects.
Instance Attribute Summary collapse
-
#brief ⇒ Object
This string have should text with brief information.
-
#details ⇒ Object
This array string have should text with details information.
-
#example ⇒ Object
This array string have should text with examples information.
-
#oname ⇒ Object
This string have should text with object name.
-
#options ⇒ Object
This array string have should text with tags information.
Class Method Summary collapse
-
.outtitle(str) ⇒ Object
Display title in follow format: *** [title] ***.
Instance Method Summary collapse
-
#display ⇒ Object
Display all information about object.
-
#initialize ⇒ Describe
constructor
A new instance of Describe.
Constructor Details
#initialize ⇒ Describe
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
#brief ⇒ Object
This string have should text with brief information.
10 11 12 |
# File 'lib/cmdlib/describe.rb', line 10 def brief @brief end |
#details ⇒ Object
This array string have should text with details information.
13 14 15 |
# File 'lib/cmdlib/describe.rb', line 13 def details @details end |
#example ⇒ Object
This array string have should text with examples information.
16 17 18 |
# File 'lib/cmdlib/describe.rb', line 16 def example @example end |
#oname ⇒ Object
This string have should text with object name.
7 8 9 |
# File 'lib/cmdlib/describe.rb', line 7 def oname @oname end |
#options ⇒ Object
This array string have should text with tags information.
19 20 21 |
# File 'lib/cmdlib/describe.rb', line 19 def @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
#display ⇒ Object
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 |