Class: Climate::Help::Man

Inherits:
Object
  • Object
show all
Defined in:
lib/climate/help/man.rb

Overview

can produce a troff file suitable for man

Defined Under Namespace

Classes: Presenter, Script

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_class, options = {}) ⇒ Man

Returns a new instance of Man.



95
96
97
98
99
# File 'lib/climate/help/man.rb', line 95

def initialize(command_class, options={})
  @command_class = command_class
  @output = options[:output] || $stdout
  @template_file = options[:template_file]
end

Instance Attribute Details

#command_classObject (readonly)

Returns the value of attribute command_class.



93
94
95
# File 'lib/climate/help/man.rb', line 93

def command_class
  @command_class
end

Instance Method Details



101
102
103
104
105
# File 'lib/climate/help/man.rb', line 101

def print
  template = Erubis::Eruby.new(File.read(@template_file))
  presenter = Presenter.new(command_class)
  @output.puts(template.result(presenter.binding))
end