Class: Climate::Help::Man::Presenter
- Inherits:
-
Object
- Object
- Climate::Help::Man::Presenter
- Defined in:
- lib/climate/help/man.rb
Instance Attribute Summary collapse
-
#command_class ⇒ Object
readonly
Returns the value of attribute command_class.
Class Method Summary collapse
Instance Method Summary collapse
- #date ⇒ Object
- #full_name ⇒ Object
-
#initialize(command_class) ⇒ Presenter
constructor
A new instance of Presenter.
- #paragraphs ⇒ Object
- #short_description ⇒ Object
- #short_name ⇒ Object
- #subcommands ⇒ Object
Constructor Details
#initialize(command_class) ⇒ Presenter
Returns a new instance of Presenter.
49 50 51 |
# File 'lib/climate/help/man.rb', line 49 def initialize(command_class) @command_class = command_class end |
Instance Attribute Details
#command_class ⇒ Object (readonly)
Returns the value of attribute command_class.
53 54 55 |
# File 'lib/climate/help/man.rb', line 53 def command_class @command_class end |
Class Method Details
.proxy(method_name) ⇒ Object
43 44 45 46 47 |
# File 'lib/climate/help/man.rb', line 43 def self.proxy(method_name) define_method(method_name) do @command_class.send(method_name) end end |
Instance Method Details
#date ⇒ Object
72 |
# File 'lib/climate/help/man.rb', line 72 def date ; Date.today.strftime('%b, %Y') ; end |
#full_name ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/climate/help/man.rb', line 57 def full_name stack = [] command_ptr = command_class while command_ptr stack.unshift(command_ptr.name) command_ptr = command_ptr.parent end stack.join(' ') end |
#paragraphs ⇒ Object
80 81 82 |
# File 'lib/climate/help/man.rb', line 80 def paragraphs command_class.description.split("\n\n") end |
#short_description ⇒ Object
84 85 86 |
# File 'lib/climate/help/man.rb', line 84 def short_description command_class.description.split(".").first end |
#short_name ⇒ Object
68 69 70 |
# File 'lib/climate/help/man.rb', line 68 def short_name command_class.name end |
#subcommands ⇒ Object
88 89 90 |
# File 'lib/climate/help/man.rb', line 88 def subcommands command_class.subcommands.map {|c| self.class.new(c) } end |