Class: GHtml2Pdf::ArgumentParser
- Inherits:
-
Object
- Object
- GHtml2Pdf::ArgumentParser
- Defined in:
- lib/ghtml2pdf/argument_parser.rb
Overview
Parses the command line arguments
Instance Attribute Summary collapse
-
#bottom_margin ⇒ Object
readonly
Returns the value of attribute bottom_margin.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#left_margin ⇒ Object
readonly
Returns the value of attribute left_margin.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#right_margin ⇒ Object
readonly
Returns the value of attribute right_margin.
-
#top_margin ⇒ Object
readonly
Returns the value of attribute top_margin.
Instance Method Summary collapse
-
#initialize(argv) ⇒ ArgumentParser
constructor
A new instance of ArgumentParser.
Constructor Details
#initialize(argv) ⇒ ArgumentParser
Returns a new instance of ArgumentParser.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/ghtml2pdf/argument_parser.rb', line 14 def initialize(argv) parser.parse! argv @input, @output, = argv raise ArgumentError, "An input filename is required" unless @input @output ||= "#{File.basename(@input, ".*")}.pdf" raise ArgumentError, "Input and output files cannot be the same" if @input == @output end |
Instance Attribute Details
#bottom_margin ⇒ Object
Returns the value of attribute bottom_margin.
12 13 14 |
# File 'lib/ghtml2pdf/argument_parser.rb', line 12 def bottom_margin @bottom_margin end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
12 13 14 |
# File 'lib/ghtml2pdf/argument_parser.rb', line 12 def input @input end |
#left_margin ⇒ Object
Returns the value of attribute left_margin.
12 13 14 |
# File 'lib/ghtml2pdf/argument_parser.rb', line 12 def left_margin @left_margin end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
12 13 14 |
# File 'lib/ghtml2pdf/argument_parser.rb', line 12 def output @output end |
#right_margin ⇒ Object
Returns the value of attribute right_margin.
12 13 14 |
# File 'lib/ghtml2pdf/argument_parser.rb', line 12 def right_margin @right_margin end |
#top_margin ⇒ Object
Returns the value of attribute top_margin.
12 13 14 |
# File 'lib/ghtml2pdf/argument_parser.rb', line 12 def top_margin @top_margin end |