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.
48 49 50 |
# File 'lib/climate/help/man.rb', line 48 def initialize(command_class) @command_class = command_class end |
Instance Attribute Details
#command_class ⇒ Object (readonly)
Returns the value of attribute command_class.
52 53 54 |
# File 'lib/climate/help/man.rb', line 52 def command_class @command_class end |
Class Method Details
.proxy(method_name) ⇒ Object
42 43 44 45 46 |
# File 'lib/climate/help/man.rb', line 42 def self.proxy(method_name) define_method(method_name) do @command_class.send(method_name) end end |
Instance Method Details
#date ⇒ Object
71 |
# File 'lib/climate/help/man.rb', line 71 def date ; Date.today.strftime('%b, %Y') ; end |
#full_name ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/climate/help/man.rb', line 56 def full_name stack = [] command_ptr = command_class while command_ptr stack.unshift(command_ptr.command_name) command_ptr = command_ptr.parent end stack.join(' ') end |
#paragraphs ⇒ Object
79 80 81 |
# File 'lib/climate/help/man.rb', line 79 def paragraphs command_class.description.split("\n\n") end |
#short_description ⇒ Object
83 84 85 |
# File 'lib/climate/help/man.rb', line 83 def short_description command_class.description.split(".").first end |
#short_name ⇒ Object
67 68 69 |
# File 'lib/climate/help/man.rb', line 67 def short_name command_class.command_name end |
#subcommands ⇒ Object
87 88 89 |
# File 'lib/climate/help/man.rb', line 87 def subcommands command_class.subcommands.map {|c| self.class.new(c) } end |