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.



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

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.



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

def command_class
  @command_class
end

Instance Method Details



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

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