Class: WickedPdf::OptionParser
- Inherits:
-
Object
- Object
- WickedPdf::OptionParser
- Defined in:
- lib/wicked_pdf/option_parser.rb
Constant Summary collapse
- BINARY_VERSION_WITHOUT_DASHES =
Gem::Version.new('0.12.0')
Instance Attribute Summary collapse
-
#binary_version ⇒ Object
readonly
Returns the value of attribute binary_version.
-
#hf_tempfiles ⇒ Object
readonly
Returns the value of attribute hf_tempfiles.
Instance Method Summary collapse
-
#initialize(binary_version = WickedPdf::DEFAULT_BINARY_VERSION) ⇒ OptionParser
constructor
A new instance of OptionParser.
- #parse(options) ⇒ Object
- #valid_option(name) ⇒ Object
Constructor Details
#initialize(binary_version = WickedPdf::DEFAULT_BINARY_VERSION) ⇒ OptionParser
Returns a new instance of OptionParser.
9 10 11 |
# File 'lib/wicked_pdf/option_parser.rb', line 9 def initialize(binary_version = WickedPdf::DEFAULT_BINARY_VERSION) @binary_version = binary_version end |
Instance Attribute Details
#binary_version ⇒ Object (readonly)
Returns the value of attribute binary_version.
7 8 9 |
# File 'lib/wicked_pdf/option_parser.rb', line 7 def binary_version @binary_version end |
#hf_tempfiles ⇒ Object (readonly)
Returns the value of attribute hf_tempfiles.
7 8 9 |
# File 'lib/wicked_pdf/option_parser.rb', line 7 def hf_tempfiles @hf_tempfiles end |
Instance Method Details
#parse(options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wicked_pdf/option_parser.rb', line 13 def parse() [ parse_extra(), parse_others(), parse_global(), parse_outline(.delete(:outline)), (:header => .delete(:header), :footer => .delete(:footer), :layout => [:layout]), parse_cover(.delete(:cover)), parse_toc(.delete(:toc)), parse_basic_auth() ].flatten end |
#valid_option(name) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/wicked_pdf/option_parser.rb', line 28 def valid_option(name) if binary_version < BINARY_VERSION_WITHOUT_DASHES "--#{name}" else name end end |